mmmfs.util: fix relative paths ending with a ".." segment
s-ol
26 days ago
25 | 25 | assert origin, "cannot resolve relative path '#{path}' without origin!" |
26 | 26 | path = "#{origin.path}/#{path}" |
27 | 27 | |
28 | while path\match '/([^/]-)/%.%./' | |
29 | path = path\gsub '/([^/]-)/%.%./', '/' | |
28 | while path\match '/([^/]-)/%.%.(%f[/\0])' | |
29 | path = path\gsub '/([^/]-)/%.%.(%f[/\0])', '%2' | |
30 | 30 | |
31 | 31 | if origin.path == path\sub 1, #origin.path |
32 | 32 | assert (origin\walk path), "couldn't resolve path '#{path}' from #{origin}" |