aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4urlobject.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2023-03-15 13:55:15 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2023-03-16 15:56:02 +0100
commitaf4cd4763a7e0a9b2b52de91ea07eff9be3aa9b0 (patch)
tree036ad96147035f5f3cd13bf418801a45b4631104 /src/qml/jsruntime/qv4urlobject.cpp
parent1fdca936fb079fb65be635f5c525f2b64651b83e (diff)
QV4: Fix formatting options for the search component of UrlObject
This fix changes the way the search component of UrlObjects is formatted by passing the correct options to QUrl::query. Namely, the EncodeDelimiters flag is no longer set. This now allows for correct encoding of backslashes in search strings. Amends 6cca731f3e1304ce98f1ec18af42e3bd06001eea. Pick-to: 6.5 Task-number: QTBUG-111014 Change-Id: Iee544dfc7ad6ba374601c8ec4690d11bf07c9b6a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4urlobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4urlobject.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4urlobject.cpp b/src/qml/jsruntime/qv4urlobject.cpp
index 4417d327c6..637d033bd4 100644
--- a/src/qml/jsruntime/qv4urlobject.cpp
+++ b/src/qml/jsruntime/qv4urlobject.cpp
@@ -248,7 +248,10 @@ QString UrlObject::search() const
if (auto url = QUrl(href()); !url.hasQuery() || url.query().isEmpty())
return QLatin1String("");
- return QLatin1Char('?') + url.query(QUrl::ComponentFormattingOptions(QUrl::ComponentFormattingOption::FullyEncoded));
+ constexpr auto options = QUrl::ComponentFormattingOption::EncodeSpaces
+ | QUrl::ComponentFormattingOption::EncodeUnicode
+ | QUrl::ComponentFormattingOption::EncodeReserved;
+ return u'?' + url.query(options);
}
QUrl UrlObject::toQUrl() const