Merge pull request #384 from adamharrison/fix-multi-directory

Handle proper path normalization if we begin with '..'.
This commit is contained in:
Adam 2021-08-12 09:53:16 -04:00 committed by GitHub
commit db3e9cb914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -284,7 +284,7 @@ function common.normalize_path(filename)
local parts = split_on_slash(filename, PATHSEP)
local accu = {}
for _, part in ipairs(parts) do
if part == '..' then
if part == '..' and #accu > 0 and accu[#accu] ~= ".." then
table.remove(accu)
elseif part ~= '.' then
table.insert(accu, part)