summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-10 15:46:39 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-10 15:46:39 +0100
commitc653bb09b3cbc4fdbb595501c4adbb161607a1fe (patch)
tree8f22cdc16f05c8ac74e6b78ce73180b5e7449335 /AK
parent39d6b96d21a999a36bb6ffec5720eb07e4598b48 (diff)
downloadserenity-c653bb09b3cbc4fdbb595501c4adbb161607a1fe.zip
Don't include empty segments in canonicalized paths.
This makes "/foo/" and "/foo" both resolve to "/foo".
Diffstat (limited to 'AK')
-rw-r--r--AK/FileSystemPath.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/AK/FileSystemPath.cpp b/AK/FileSystemPath.cpp
index 8c5ffb4932..88dce0aa56 100644
--- a/AK/FileSystemPath.cpp
+++ b/AK/FileSystemPath.cpp
@@ -26,7 +26,8 @@ bool FileSystemPath::canonicalize(bool resolveSymbolicLinks)
canonicalParts.takeLast();
continue;
}
- canonicalParts.append(part);
+ if (!part.isEmpty())
+ canonicalParts.append(part);
}
if (canonicalParts.isEmpty()) {
m_string = "/";