diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-15 15:48:40 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-22 09:10:18 +0200 |
commit | 8a3f8595569a920cf2fa811704dec97ae31be15d (patch) | |
tree | 84496eca2ae5330492ae54c7cf08531471127e3f /src/qml/qml/qqmlproperty.cpp | |
parent | 64fb25a2acada6d9f0897b7e8db4583de4d8d2be (diff) |
Revert "Decode directory separators in source URLs"
This reverts commit 7ec30c51b287159377761338fe6d3b48706d74ee.
We don't want to half-decode directory separators on assignment. This
just introduces inconsistency down the line.
[ChangeLog][QtQml][Important Behavior Changes] Percent-encoded directory
separators in URLs are not automatically decoded on assignment to url
properties anymore. This was obviously not a good idea to begin with.
Fixes: QTBUG-81244
Change-Id: I1938abbe8aada88beff0d628397674255e8b2472
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 864f97a417..adfa76ea24 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1309,21 +1309,14 @@ bool QQmlPropertyPrivate::write( return property.writeProperty(object, const_cast<QVariant *>(&value), flags); } else if (isUrl) { QUrl u; - if (variantType == QMetaType::QUrl) { + if (variantType == QMetaType::QUrl) u = value.toUrl(); - } else if (variantType == QMetaType::QByteArray) { - QString input(QString::fromUtf8(value.toByteArray())); - // Encoded dir-separators defeat QUrl processing - decode them first - input.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive); - u = QUrl(input); - } else if (variantType == QMetaType::QString) { - QString input(value.toString()); - // Encoded dir-separators defeat QUrl processing - decode them first - input.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive); - u = QUrl(input); - } else { + else if (variantType == QMetaType::QByteArray) + u = QUrl(QString::fromUtf8(value.toByteArray())); + else if (variantType == QMetaType::QString) + u = QUrl(value.toString()); + else return false; - } if (context && u.isRelative() && !u.isEmpty()) u = context->resolvedUrl(u); |