aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/filepath.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2025-08-22 14:57:45 +0200
committerhjk <[email protected]>2025-08-22 15:08:30 +0000
commitcfce159ab9d7b0b4c15d010cde6a20942e2648f5 (patch)
tree2752c1a949dccff2baaaca4d5dfe2c8f92453f1d /src/libs/utils/filepath.cpp
parent2748f1da5d59f6d49ece4ab22e861fef1212572c (diff)
Utils: Fix FilePath::fromUserInput for relative remote pathsHEADmaster
Change-Id: I5f48b2ad5a593dea0c257523351b10e292208cc2 Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'src/libs/utils/filepath.cpp')
-rw-r--r--src/libs/utils/filepath.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp
index 031305ba4cc..a480f479d2f 100644
--- a/src/libs/utils/filepath.cpp
+++ b/src/libs/utils/filepath.cpp
@@ -1159,7 +1159,21 @@ QString doCleanPath(const QString &input_)
--prefixLen;
}
- QString path = normalizePathSegmentHelper(input.mid(prefixLen));
+ // We need to preserve a leading ./ for remote paths.
+ bool reAddDotSlash = false;
+
+ QString path = input.mid(prefixLen);
+ if (shLen > 0 && path.startsWith("./"))
+ reAddDotSlash = true;
+
+ path = normalizePathSegmentHelper(path);
+
+ if (reAddDotSlash) {
+ if (!path.startsWith("./"))
+ path.prepend("./");
+ else
+ QTC_CHECK(false);
+ }
// Strip away last slash except for root directories
if (path.size() > 1 && path.endsWith(u'/'))