Commit b59b7450 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 425219 - suspicious URL warning system gives false positive for URL with port number

FIXED-IN: 5.15.1
BUG: 425219
parent 37beb69f
Pipeline #32579 passed with stage
in 41 minutes and 33 seconds
......@@ -150,6 +150,10 @@ void ScamDetectionWebEngineTest::scamtest_data()
QTest::newRow("wierd1") << QStringLiteral(
"<a href=\"http://www.weezevent.com?c=sys_mail\">http://www.weezevent.com?c=sys_mail</a>")
<< false;
QTest::newRow("urlwithport") << QStringLiteral(
"<a href=\"https://example.com:443/blablabla\">https://example.com:443/blablabla</a>")
<< false;
}
void ScamDetectionWebEngineTest::scamtest()
......
......@@ -98,6 +98,7 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
//1) detect if title has a url and title != href
const QString title = mapVariant.value(QStringLiteral("title")).toString();
const QString href = mapVariant.value(QStringLiteral("src")).toString();
//qDebug() << " href " << href << " title " << title;
const QUrl url(href);
if (!title.isEmpty()) {
if (title.startsWith(QLatin1String("http:"))
......@@ -163,7 +164,8 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
}
if (!foundScam) {
QUrl displayUrl = QUrl(mapVariant.value(QStringLiteral("text")).toString());
QString text = displayUrl.toDisplayString(QUrl::StripTrailingSlash|QUrl::NormalizePathSegments);
//qDebug() << " displayUrl "<< displayUrl;
QString text = displayUrl.toDisplayString(QUrl::StripTrailingSlash|QUrl::NormalizePathSegments|QUrl::RemovePort);
if (text.endsWith(QLatin1String("%22"))) {
text.chop(3);
}
......
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