diff options
-rw-r--r-- | src/corelib/io/qurl.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index ca74544e55..5cc49c8192 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2502,11 +2502,11 @@ QString QUrl::toLocalFile() const return QString(); QString tmp; - QString ourPath = path(); + QString ourPath = path(QUrl::MostDecoded); // magic for shared drive on windows if (!d->host.isEmpty()) { - tmp = QStringLiteral("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/') + tmp = QStringLiteral("//") + host() + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/') ? QLatin1Char('/') + ourPath : ourPath); } else { tmp = ourPath; diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 7e6dd14e82..2b7a467192 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1027,6 +1027,7 @@ void tst_QUrl::toLocalFile_data() QTest::newRow("data8") << QString::fromLatin1("file://somehost") << QString::fromLatin1("//somehost"); QTest::newRow("data9") << QString::fromLatin1("file:////somehost/somedir/somefile") << QString::fromLatin1("//somehost/somedir/somefile"); QTest::newRow("data10") << QString::fromLatin1("FILE:/a.txt") << QString::fromLatin1("/a.txt"); + QTest::newRow("data11") << QString::fromLatin1("file:///Mambo <%235>.mp3") << QString::fromLatin1("/Mambo <#5>.mp3"); // and some that result in empty (i.e., not local) QTest::newRow("xdata0") << QString::fromLatin1("/a.txt") << QString(); |