diff --git a/src/navigation/locationbar.cpp b/src/navigation/locationbar.cpp index b299e1e46..addbbdb52 100644 --- a/src/navigation/locationbar.cpp +++ b/src/navigation/locationbar.cpp @@ -36,6 +36,7 @@ #include "goicon.h" #include "rssicon.h" #include "downicon.h" +#include "globalfunctions.h" LocationBar::LocationBar(QupZilla* mainClass) : LineEdit() @@ -199,7 +200,7 @@ void LocationBar::showUrl(const QUrl &url) return; } - QString stringUrl = url.toString(); + QString stringUrl = qz_urlEncodeQueryString(url); if (stringUrl == "qupzilla:speeddial" || stringUrl == "about:blank") { stringUrl = ""; diff --git a/src/popupwindow/popuplocationbar.cpp b/src/popupwindow/popuplocationbar.cpp index 3774001f6..89819eeee 100644 --- a/src/popupwindow/popuplocationbar.cpp +++ b/src/popupwindow/popuplocationbar.cpp @@ -18,8 +18,7 @@ #include "popuplocationbar.h" #include "popupwebview.h" #include "toolbutton.h" - -#include +#include "globalfunctions.h" class PopupSiteIcon : public QWidget { @@ -62,7 +61,7 @@ void PopupLocationBar::setView(PopupWebView* view) void PopupLocationBar::showUrl(const QUrl &url) { - setText(url.toString()); + setText(qz_urlEncodeQueryString(url)); setCursorPosition(0); } diff --git a/src/tools/globalfunctions.cpp b/src/tools/globalfunctions.cpp index eadabbbeb..41c686f91 100644 --- a/src/tools/globalfunctions.cpp +++ b/src/tools/globalfunctions.cpp @@ -148,6 +148,15 @@ QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl) return returnUrl; } +QString qz_urlEncodeQueryString(const QUrl &url) +{ + QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment); + returnString.append(url.encodedQuery()); + returnString.append(url.encodedFragment()); + + return returnString; +} + QString qz_ensureUniqueFilename(const QString &pathToFile) { if (!QFile::exists(pathToFile)) { diff --git a/src/tools/globalfunctions.h b/src/tools/globalfunctions.h index 9ebdee9af..2298ae3ad 100644 --- a/src/tools/globalfunctions.h +++ b/src/tools/globalfunctions.h @@ -42,6 +42,7 @@ void qz_removeDir(const QString &d); QString qz_samePartOfStrings(const QString &one, const QString &other); QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl); +QString qz_urlEncodeQueryString(const QUrl &url); QString qz_ensureUniqueFilename(const QString &name); QString qz_getFileNameFromUrl(const QUrl &url);