Webui save - fix white space writing (#364)

* implement config save over http post instead of json

* remove json set config
finish config write thrugh http post

* remove debug code and add failure messages

* fix save issue with white spaces
This commit is contained in:
redPanther 2017-01-15 08:53:52 +01:00 committed by GitHub
parent 8a9d2760ef
commit 281b1c8ea5
2 changed files with 3 additions and 2 deletions

View File

@ -229,7 +229,7 @@ function requestWriteConfig(config)
complete_config[i] = val; complete_config[i] = val;
}); });
var config_str = encode_utf8(JSON.stringify(complete_config)); var config_str = escape(encode_utf8(JSON.stringify(complete_config)));
$.post( "/cgi/cfg_set", { cfg: config_str }) $.post( "/cgi/cfg_set", { cfg: config_str })
.done(function( data ) { .done(function( data ) {

View File

@ -94,7 +94,7 @@ void CgiHandler::cmd_cfg_set()
QJsonParseError error; QJsonParseError error;
if (data.contains("cfg")) if (data.contains("cfg"))
{ {
QJsonDocument hyperionConfig = QJsonDocument::fromJson(data["cfg"], &error); QJsonDocument hyperionConfig = QJsonDocument::fromJson(QByteArray::fromPercentEncoding(data["cfg"]), &error);
if (error.error == QJsonParseError::NoError) if (error.error == QJsonParseError::NoError)
{ {
@ -103,6 +103,7 @@ void CgiHandler::cmd_cfg_set()
} }
else else
{ {
//Debug(_log, "error while saving: %s", error.errorString()).toLocal8bit.constData());
_reply->appendRawData (QString("Error while validating json: "+error.errorString()).toUtf8()); _reply->appendRawData (QString("Error while validating json: "+error.errorString()).toUtf8());
} }
} }