summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2019-01-02 08:43:10 +0100
committerLaurent Montel <[email protected]>2019-01-02 08:43:10 +0100
commit699120d0138beb88e1d8646af503f59456c1c725 (patch)
tree9a715f7f95dcb0e76218977b53d5a6cb1503d9a0
parenta5b272e54e931b7c694004360d2de5583a98037f (diff)
api.longurl.org doesn't work now. Use lengthenurl.infov18.12.1
-rw-r--r--messageviewer/src/scamdetection/scamexpandurljob.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/messageviewer/src/scamdetection/scamexpandurljob.cpp b/messageviewer/src/scamdetection/scamexpandurljob.cpp
index 2df2876..c929f65 100644
--- a/messageviewer/src/scamdetection/scamexpandurljob.cpp
+++ b/messageviewer/src/scamdetection/scamexpandurljob.cpp
@@ -69,7 +69,7 @@ void ScamExpandUrlJob::expandedUrl(const QUrl &url)
deleteLater();
return;
}
- const QUrl newUrl(QStringLiteral("http://api.longurl.org/v2/expand?url=%1&format=json").arg(
+ const QUrl newUrl(QStringLiteral("https://lengthenurl.info/api/longurl/shorturl/?inputURL=%1&format=json").arg(
url.url()));
qCDebug(MESSAGEVIEWER_LOG) << " newUrl " << newUrl;
@@ -86,12 +86,14 @@ void ScamExpandUrlJob::slotExpandFinished(QNetworkReply *reply)
if (!reply->property("shortUrl").isNull()) {
shortUrl.setUrl(reply->property("shortUrl").toString());
}
- QJsonDocument jsonDoc = QJsonDocument::fromBinaryData(reply->readAll());
+ const QByteArray ba = reply->readAll();
+ //qDebug() << " reply->readAll()" << ba;
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(ba);
reply->deleteLater();
if (!jsonDoc.isNull()) {
const QMap<QString, QVariant> map = jsonDoc.toVariant().toMap();
QUrl longUrl;
- const QVariant longUrlVar = map.value(QStringLiteral("long-url"));
+ const QVariant longUrlVar = map.value(QStringLiteral("LongURL"));
if (longUrlVar.isValid()) {
longUrl.setUrl(longUrlVar.toString());
} else {