From 1ee5a85843bf3c6de08185c92fd3eb605d8c328c Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Tue, 18 May 2021 23:14:25 +0200 Subject: Fix QUrl::fromLocalFile with long path prefix After commit 3966b571 the function was kinda broken already, though this got unnoticed since it was not covered by an the auto-test. This commit adds another test case with Windows native separators and removes the use of QDir::fromNativeSeparators. Instead use the original code from QDir::fromNativeSeparators to replace the backslashes. Change-Id: I190560d0e75cb8c177d63b142aa4be5b01498da2 Reviewed-by: Volker Hilsheimer (cherry picked from commit 06689a2d7a18882535819ed13ac7248c81330529) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index e46b6eb329..d3ef6fbeca 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1329,6 +1329,10 @@ void tst_QUrl::fromLocalFile_data() << QString(QString("//somehost") + suffix).replace('/', '\\') << QString("file://somehost") + suffix << QString(suffix); + QTest::addRow("windows-backslash-extlen-%s", pathDescription) + << QString(QString("//?") + suffix).replace('/', '\\') + << QString("file:////%3F") + suffix + << QString("//?") + suffix; #endif QTest::addRow("windows-extlen-%s", pathDescription) << QString("//?") + suffix -- cgit v1.2.3