summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-03-08 13:29:15 +0100
committerLaurent Montel <[email protected]>2018-03-08 13:29:15 +0100
commite2c939b32e4aec7b9ef699070ed46a01f680c5c8 (patch)
tree306f1838ce41fac0d1981bf9e4e8f55009dcf02b
parent698f6ae119f27f3dbe0338e1e1142fc0ff5d8194 (diff)
Fix more false positive
-rw-r--r--messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp4
-rw-r--r--messageviewer/src/scamdetection/scamdetectionwebengine.cpp12
2 files changed, 11 insertions, 5 deletions
diff --git a/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp b/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp
index 2dba8cc..c2d9166 100644
--- a/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp
+++ b/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp
@@ -138,7 +138,9 @@ void ScamDetectionWebEngineTest::scamtest_data()
QTest::newRow("scam-lowercase-2") << QStringLiteral(
"<a href=\"http://www.Kde.org/KDE/bla\">http://www.Kde.org/KDE/bla</a>")
<< false;
-
+ QTest::newRow("scam-lowercase-3") << QStringLiteral(
+ "<a href=\"http://code.qt.io/cgit/%7bnon-gerrit%7d/qt-labs/opencl.git\">http://code.qt.io/cgit/%7bnon-gerrit%7d/qt-labs/opencl.git</a>")
+ << false;
}
void ScamDetectionWebEngineTest::scamtest()
diff --git a/messageviewer/src/scamdetection/scamdetectionwebengine.cpp b/messageviewer/src/scamdetection/scamdetectionwebengine.cpp
index 52001f3..05078e6 100644
--- a/messageviewer/src/scamdetection/scamdetectionwebengine.cpp
+++ b/messageviewer/src/scamdetection/scamdetectionwebengine.cpp
@@ -182,11 +182,15 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
if (text != href) {
if (href != (text + QLatin1Char('/'))) {
if (href.toHtmlEscaped() != text) {
+ //qDebug() << " href: " << href << "text: " << text;
+
if (QString::fromUtf8(QUrl(text).toEncoded()) != href) {
- d->mDetails += QLatin1String("<li>") + i18n(
- "This email contains a link which reads as '%1' in the text, but actually points to '%2'. This is often the case in scam emails to mislead the recipient",
- addWarningColor(text), addWarningColor(href)) + QLatin1String("</li>");
- foundScam = true;
+ if (QUrl(href).toDisplayString() != text) {
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a link which reads as '%1' in the text, but actually points to '%2'. This is often the case in scam emails to mislead the recipient",
+ addWarningColor(text), addWarningColor(href)) + QLatin1String("</li>");
+ foundScam = true;
+ }
}
}
}