diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 7d2178311..4a37bfd28 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -269,7 +269,7 @@ LocationBar::LoadAction LocationBar::loadAction(const QString &text) // Only allow whitelisted schemes const QSet whitelistedSchemes = { QSL("http"), QSL("https"), QSL("ftp"), QSL("file"), - QSL("about"), QSL("qupzilla") + QSL("data"), QSL("about"), QSL("qupzilla") }; if (whitelistedSchemes.contains(guessedUrl.scheme())) { action.type = LoadAction::Url; diff --git a/tests/autotests/locationbartest.cpp b/tests/autotests/locationbartest.cpp index 042fc563f..1984c21fc 100644 --- a/tests/autotests/locationbartest.cpp +++ b/tests/autotests/locationbartest.cpp @@ -153,3 +153,24 @@ void LocationBarTest::loadAction_kdebug389491() QCOMPARE(action.type, LocationBar::LoadAction::Url); QCOMPARE(action.loadRequest.url(), QUrl("http://website.com?search=searchterm and another")); } + +void LocationBarTest::loadActionSpecialSchemesTest() +{ + LocationBar::LoadAction action; + + action = LocationBar::loadAction("data:image/png;base64,xxxxx"); + QCOMPARE(action.type, LocationBar::LoadAction::Url); + QCOMPARE(action.loadRequest.url(), QUrl("data:image/png;base64,xxxxx")); + + action = LocationBar::loadAction("qupzilla:about"); + QCOMPARE(action.type, LocationBar::LoadAction::Url); + QCOMPARE(action.loadRequest.url(), QUrl("qupzilla:about")); + + action = LocationBar::loadAction("file:test.html"); + QCOMPARE(action.type, LocationBar::LoadAction::Url); + QCOMPARE(action.loadRequest.url(), QUrl("file:test.html")); + + action = LocationBar::loadAction("about:blank"); + QCOMPARE(action.type, LocationBar::LoadAction::Url); + QCOMPARE(action.loadRequest.url(), QUrl("about:blank")); +} diff --git a/tests/autotests/locationbartest.h b/tests/autotests/locationbartest.h index a24667a85..d93162ecf 100644 --- a/tests/autotests/locationbartest.h +++ b/tests/autotests/locationbartest.h @@ -32,4 +32,5 @@ private slots: void loadActionBookmarksTest(); void loadActionSearchTest(); void loadAction_kdebug389491(); + void loadActionSpecialSchemesTest(); };