1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

LocationBar: Use WebPage::supportedSchemes to find which schemes to load

This commit is contained in:
David Rosca 2018-03-16 15:31:37 +01:00
parent e6601baf1f
commit 6241e8d37f
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -283,12 +283,8 @@ LocationBar::LoadAction LocationBar::loadAction(const QString &text)
const bool forceLoad = guessedUrl.scheme() == QL1S("javascript");
// Only allow spaces in query
if (forceLoad || !QzTools::containsSpace(guessedUrl.toString(QUrl::RemoveQuery))) {
// Only allow whitelisted schemes
static const QSet<QString> whitelistedSchemes = {
QSL("http"), QSL("https"), QSL("ftp"), QSL("file"),
QSL("data"), QSL("about"), QSL("falkon")
};
if (forceLoad || whitelistedSchemes.contains(guessedUrl.scheme())) {
// Only allow supported schemes
if (forceLoad || WebPage::supportedSchemes().contains(guessedUrl.scheme())) {
action.type = LoadAction::Url;
action.loadRequest = guessedUrl;
return action;