Commit 022a0bdf authored by Laurent Montel's avatar Laurent Montel 😁

Fix a false positive

parent 973236f1
......@@ -122,7 +122,11 @@ void ScamDetectionWebEngineTest::scamtest_data()
QTest::newRow("scam") << QStringLiteral(
"<html><body><a href=\"http://dfgdgsfdgsfdgsfd.foo.com/#contact@bla.org\">https://www.bli.com/manager/dedicated/index.html#/billing/mean</a></html>")
<<true;
<< true;
QTest::newRow("scam-amp") << QStringLiteral(
"<a href=\"https://bugs.kde.org/enter_bug.cgi?format=guided&amp;product=gcompris\">https://bugs.kde.org/enter_bug.cgi?format=guided&amp;amp;product=gcompris</a></div>")
<< false;
}
void ScamDetectionWebEngineTest::scamtest()
......
......@@ -181,10 +181,12 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
if (text.startsWith(QLatin1String("http:/")) || text.startsWith(QLatin1String("https:/"))) {
if(text != href) {
if (href != (text + QLatin1Char('/'))) {
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 (href.toHtmlEscaped() != 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;
}
}
}
}
......@@ -198,7 +200,7 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
foundScam = true;
}
d->mDetails += QLatin1String("</ul>");
//qDebug()<<" d->mDetails "<< d->mDetails;
// qDebug()<<" d->mDetails "<< d->mDetails;
if (foundScam) {
Q_EMIT messageMayBeAScam();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment