diff options
| author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-07-27 15:24:51 +0200 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-07-27 15:06:35 +0000 |
| commit | 2b648adac20ca809af0b496ecb6fdef74b157799 (patch) | |
| tree | ceea012ff218b9521944f9c2ded9f5d58f83dc82 | |
| parent | b7cf8ee98cdabd0ff518c9ed4ff993d7c556c19b (diff) | |
| download | qbs-2b648adac20ca809af0b496ecb6fdef74b157799.tar.gz | |
Fix FileInfo::resolvePath().
Contrary to what it claims, it did not return a clean path if the
relative path was "..".
Change-Id: I812e5f4c6c3689b8726c359ad92d4830b93de30a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| -rw-r--r-- | src/lib/corelib/tools/fileinfo.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/corelib/tools/fileinfo.cpp b/src/lib/corelib/tools/fileinfo.cpp index c34c2139a..0cf15689c 100644 --- a/src/lib/corelib/tools/fileinfo.cpp +++ b/src/lib/corelib/tools/fileinfo.cpp @@ -193,6 +193,12 @@ QString FileInfo::resolvePath(const QString &base, const QString &rel) if (idx >= 0) r.truncate(idx); } + if (s == QLatin1String("..")) { + int idx = r.lastIndexOf(QLatin1Char('/')); + if (idx >= 0) + r.truncate(idx); + return r; + } r.reserve(r.length() + 1 + s.length()); r += QLatin1Char('/'); |
