refs #751, detect invalid JSON message

(which normally means a PHP error message in HTML)
* utility function to remove HTML parts
* adjustments
This commit is contained in:
Klaus Basan
2016-08-31 17:13:40 +02:00
committed by Roland Winklmeier
parent 2cc88d9c6a
commit 03c642d88a
4 changed files with 22 additions and 5 deletions

View File

@@ -28,6 +28,7 @@
#include <QUrlQuery>
#include <QVariant>
#include <QtDebug>
#include <QRegularExpression>
using namespace BlackConfig;
using namespace BlackMisc;
@@ -278,5 +279,13 @@ namespace BlackMisc
}
return -1;
}
QString CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(const QString &errorMessage)
{
if (errorMessage.isEmpty()) { return errorMessage; }
QString phpError(errorMessage);
static const QRegularExpression regEx("<[^>]*>");
return phpError.remove(regEx);
}
} // namespace
} // namespacee