Skip to content

Commit

Permalink
feat(browser): improve local file detection
Browse files Browse the repository at this point in the history
  • Loading branch information
trollixx committed Feb 2, 2020
1 parent 03e0e1e commit 096dcbf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/libs/browser/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 096dcbf

Please sign in to comment.