1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge branch 'Falkon/3.0'

This commit is contained in:
David Rosca 2018-03-28 18:56:26 +02:00
commit d329db7a08
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 16 additions and 2 deletions

View File

@ -214,4 +214,17 @@ void LocationBarTest::loadAction_issue2578()
QCOMPARE(action.type, LocationBar::LoadAction::Invalid);
}
void LocationBarTest::loadAction_kdebug392445()
{
// %20 in url will make it incorrectly treat as web search
qzSettings->searchFromAddressBar = true;
LocationBar::LoadAction action;
action = LocationBar::loadAction("http://www.example.com/my%20beautiful%20page");
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://www.example.com/my%20beautiful%20page"));
}
FALKONTEST_MAIN(LocationBarTest)

View File

@ -34,4 +34,5 @@ private Q_SLOTS:
void loadAction_kdebug389491();
void loadActionSpecialSchemesTest();
void loadAction_issue2578();
void loadAction_kdebug392445();
};

View File

@ -277,12 +277,12 @@ LocationBar::LoadAction LocationBar::loadAction(const QString &text)
}
// Otherwise load as url
const QUrl &guessedUrl = QUrl::fromUserInput(t);
const QUrl guessedUrl = QUrl::fromUserInput(t);
if (guessedUrl.isValid()) {
// Always allow javascript: to be loaded
const bool forceLoad = guessedUrl.scheme() == QL1S("javascript");
// Only allow spaces in query
if (forceLoad || !QzTools::containsSpace(guessedUrl.toString(QUrl::RemoveQuery))) {
if (forceLoad || !QzTools::containsSpace(t) || !QzTools::containsSpace(guessedUrl.toString(QUrl::RemoveQuery))) {
// Only allow supported schemes
if (forceLoad || WebPage::supportedSchemes().contains(guessedUrl.scheme())) {
action.type = LoadAction::Url;