diff options
-rw-r--r-- | src/core/file_picker_controller.cpp | 4 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_filePicker.qml | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 334321273..4b0576465 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -95,7 +95,7 @@ void FilePickerController::accepted(const QStringList &files) if (urlString.startsWith("file:")) { base::FilePath filePath = toFilePath(urlString).NormalizePathSeparators(); std::vector<base::FilePath::StringType> pathComponents; - // Splits the file URL into host name, path and file name. + // Splits the file URL into scheme, host name, path and file name. filePath.GetComponents(&pathComponents); QString absolutePath; @@ -107,7 +107,7 @@ void FilePickerController::accepted(const QStringList &files) if (scheme.size() > 5) { #if defined(OS_WIN) // There is no slash at the end of the file scheme and it is valid on Windows: file:C:/ - if (scheme.at(5).isLetter() && scheme.at(6) != ':') { + if (scheme.size() == 7 && scheme.at(5).isLetter() && scheme.at(6) == ':') { absolutePath += scheme.at(5) + ":/"; } else { #endif diff --git a/tests/auto/quick/qmltests2/data/tst_filePicker.qml b/tests/auto/quick/qmltests2/data/tst_filePicker.qml index 4313c8d9e..26d74e2d3 100644 --- a/tests/auto/quick/qmltests2/data/tst_filePicker.qml +++ b/tests/auto/quick/qmltests2/data/tst_filePicker.qml @@ -227,15 +227,15 @@ TestWebEngineView { { tag: "file://applib/products/a%2Db/ abc%5F9/4148.920a/media/test.txt", input: "file://applib/products/a%2Db/ abc%5F9/4148.920a/media/test.txt", expected: "test.txt"}, { tag: "file://applib/products/a-b/abc_1/t.est/test.txt", input: "file://applib/products/a-b/abc_1/t.est/test.txt", expected: "test.txt"}, { tag: "file:\\\\applib\\products\\a-b\\abc_1\\t:est\\test.txt", input: "file:\\\\applib\\products\\a-b\\abc_1\\t:est\\test.txt", expected: "test.txt"}, - { tag: "file:C:/test.txt", input: "file:C:/test.txt", expected: "test.tx"}, - { tag: "file:/C:/test.txt", input: "file:/C:/test.txt", expected: "test.tx"}, + { tag: "file:C:/test.txt", input: "file:C:/test.txt", expected: "test.txt"}, + { tag: "file:/C:/test.txt", input: "file:/C:/test.txt", expected: "test.txt"}, { tag: "file://C:/test.txt", input: "file://C:/test.txt", expected: "Failed to Upload"}, { tag: "file:///C:test.txt", input: "file:///C:test.txt", expected: "Failed to Upload"}, { tag: "file:///C:/test.txt", input: "file:///C:/test.txt", expected: "test.txt"}, { tag: "file:///C:\\test.txt", input: "file:///C:\\test.txt", expected: "test.txt"}, { tag: "file:\\//C:/test.txt", input: "file:\\//C:/test.txt", expected: "test.txt"}, { tag: "file:\\\\/C:\\test.txt", input: "file:\\\\/C:\\test.txt", expected: "test.txt"}, - { tag: "\\\\?\\C:/test.txt", input: "\\\\?\\C:/test.txt", expected: "test.tx"}, + { tag: "\\\\?\\C:/test.txt", input: "\\\\?\\C:/test.txt", expected: "test.txt"}, ]; } |