From 096dcbf07f713e5c8ea5d59310af381727f69ba0 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Tue, 28 Jan 2020 01:26:52 -0500 Subject: [PATCH] feat(browser): improve local file detection --- src/libs/browser/webview.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libs/browser/webview.cpp b/src/libs/browser/webview.cpp index d455b42cf..9a62e9316 100644 --- a/src/libs/browser/webview.cpp +++ b/src/libs/browser/webview.cpp @@ -315,11 +315,13 @@ QWebHitTestResult WebView::hitTestContent(const QPoint &pos) const bool WebView::isExternalUrl(const QUrl &url) { - static const QStringList localSchemes = { - QStringLiteral("file"), - QStringLiteral("qrc"), - }; + if (url.isLocalFile() || url.scheme() == QStringLiteral("qrc")) { + return false; + } + + if (url.host().startsWith(QStringLiteral("127."))) { + return false; + } - const QString scheme = url.scheme(); - return !scheme.isEmpty() && !localSchemes.contains(scheme); + return true; }