aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-06-19 10:24:01 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-25 01:50:37 +0200
commit2c4595ad02ff35011c24ea71c193d5a9710bec30 (patch)
treea6eb3d3da97e2aafd3fff03de22b1d884bdd2d25 /src/qml/qml/qqmlproperty.cpp
parent2753e9a795537df10c5a3b64ec9f6d8d81381837 (diff)
Decode directory separators in source URLs
URLs with encoded directory-separator characters are not correctly processed by QUrl. Task-number: QTBUG-25981 Change-Id: I78173ef44c4850774b56753335bea34db04c0735 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 33f860fb17..d0c2761373 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1319,10 +1319,16 @@ bool QQmlPropertyPrivate::write(QObject *object,
u = value.toUrl();
found = true;
} else if (variantType == QVariant::ByteArray) {
- u = QUrl(QString::fromUtf8(value.toByteArray()));
+ 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);
found = true;
} else if (variantType == QVariant::String) {
- u = QUrl(value.toString());
+ QString input(value.toString());
+ // Encoded dir-separators defeat QUrl processing - decode them first
+ input.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive);
+ u = QUrl(input);
found = true;
}