From c653bb09b3cbc4fdbb595501c4adbb161607a1fe Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 10 Nov 2018 15:46:39 +0100 Subject: [PATCH] Don't include empty segments in canonicalized paths. This makes "/foo/" and "/foo" both resolve to "/foo". --- AK/FileSystemPath.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 = "/";