summaryrefslogtreecommitdiffstats
path: root/src/core/file_picker_controller.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2021-05-05 18:39:54 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2021-05-12 21:03:33 +0200
commitade5679e6de16bfe7bf4d3c56701947b1396b0a3 (patch)
tree9f222b308ed0f508782cc146baf1f10d4c2f1086 /src/core/file_picker_controller.cpp
parent33e08cdfdfcb6ed759d5ba529db7e7b31484ee16 (diff)
Fix FilePickerController's path validation for windows and corresponding tests
Change-Id: If2445171232864cb4ac51888ccc93bc00cb099a2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/file_picker_controller.cpp')
-rw-r--r--src/core/file_picker_controller.cpp4
1 files changed, 2 insertions, 2 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