diff options
author | Andrew Knight <andrew.knight@digia.com> | 2014-03-18 00:08:49 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 07:21:57 +0100 |
commit | 3f7951c04ef474f81eda2134b67c4e4020fe39d1 (patch) | |
tree | db4cb95ef8739f2d97c4e11a25b6dd4979c86b16 /tests | |
parent | ecd4a9ba23c0c538e73dc4f9e75c4d5361ba4c0e (diff) |
Use QUrl::toLocalFile() when decoding a string URL
Some percent-decoded characters may still be present in the string URL,
so it is best to use QUrl::toLocalFile() to process the string properly.
This also makes some drive handling "magic" obselete as QUrl already
handles this.
This fixes an issue whereby QML apps residing in local paths requiring
percent-encoded characters (or which import local file URLs with
percent-encoded characters) would fail to load, as the path was passed
to the file system engine without fully decoding the URL.
Change-Id: I8ec2b06f0661e0ac7cc9df79d35ec5cee211f672
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/{subdir}/Test.qml | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/{subdir}/Test.qml b/tests/auto/qml/qqmllanguage/data/{subdir}/Test.qml new file mode 100644 index 0000000000..f789a905f2 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/{subdir}/Test.qml @@ -0,0 +1,2 @@ +import QtQuick 2.0 +Rectangle { } diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index f48e405dff..78fff58841 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -2210,6 +2210,11 @@ void tst_qqmllanguage::importsLocal_data() "Test {}" << (!qmlCheckTypes()?"TestType":"") << (!qmlCheckTypes()?"":"Test is ambiguous. Found in org/qtproject/Test/ and in subdir/"); + QTest::newRow("file URL survives percent-encoding") + << "import \"" + QUrl::fromLocalFile(QDir::currentPath() + "/{subdir}").toString() + "\"\n" + "Test {}" + << "QQuickRectangle" + << ""; } void tst_qqmllanguage::importsLocal() |