Skip to content

Commit

Permalink
Correctly handle /./../ sequences in toAbsPath
Browse files Browse the repository at this point in the history
  • Loading branch information
burningrooftop committed Jan 31, 2024
1 parent 5c718b7 commit 391fda7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/osfiles.s7i
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ const func string: toAbsPath (in string: basePath, in string: path) is func
else
absolutePath := getcwd & "/" & basePath & "/" & path;
end if;
absolutePath := replace(absolutePath, "/./", "/");
dotdotPos := pos(absolutePath, "/..");
while dotdotPos <> 0 do
slashPos := rpos(absolutePath, '/', pred(dotdotPos));
Expand All @@ -787,7 +788,6 @@ const func string: toAbsPath (in string: basePath, in string: path) is func
dotdotPos := pos(absolutePath, "/..", succ(dotdotPos));
end if;
end while;
absolutePath := replace(absolutePath, "/./", "/");
if endsWith(absolutePath, "/.") then
if absolutePath = "/." then
absolutePath := "/";
Expand Down

0 comments on commit 391fda7

Please sign in to comment.