Commit 229f211c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Spam false-positive, because KMail mis-parses some links

BUG: 448029
FIXED-IN: 5.19.2
parent 4295c017
Pipeline #119963 passed with stage
in 8 minutes and 36 seconds
......@@ -50,6 +50,7 @@ void ScamDetectionWebEngineTest::scamtest_data()
{
QTest::addColumn<QString>("html");
QTest::addColumn<bool>("result");
// No Scam
QTest::newRow("noscam1") << QStringLiteral("<html><body><a href=\"www.kde.org\">kde</a></body></html>") << false;
QTest::newRow("noscam2") << QStringLiteral("<html><body><a href=\"http://www.kde.org\" title=\"http://www.kde.org\">kde</a></body></html>") << false;
......@@ -138,6 +139,10 @@ void ScamDetectionWebEngineTest::scamtest_data()
QTest::newRow("BUG440635") << QStringLiteral(
R"(<a href="https://codereview.qt-project.org/q/topic:%22api-change-review-6.2%22+(status:open%20OR%20status:abandoned">https://codereview.qt-project.org/q/topic:%22api-change-review-6.2%22+(status:open%20OR%20status:abandoned</a>)")
<< false;
QTest::newRow("BUG448029") << QStringLiteral(
R"(<a href="https://bugreports.qt.io/issues/?jql=text%20~%20%22gadget%20qml%22">https://bugreports.qt.io/issues/?jql=text%20~%20%22gadget%20qml%22</a>)")
<< false;
}
void ScamDetectionWebEngineTest::scamtest()
......
......@@ -175,6 +175,9 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
normalizedHref.replace(QStringLiteral("%5C"), QStringLiteral("/"));
}
}
if (normalizedHref.endsWith(QLatin1String("%22"))) {
normalizedHref.chop(3);
}
// qDebug() << "text " << text << " href "<<href << " normalizedHref " << normalizedHref;
if (!text.isEmpty()) {
......
Supports Markdown
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