mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
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:
committed by
Roland Winklmeier
parent
2cc88d9c6a
commit
03c642d88a
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user