From d82327aec15838b4c1aa44a3dfbdb04891691ab1 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sun, 3 Sep 2023 23:43:36 +0200 Subject: mmmfs.util: fix relative paths ending with a ".." segment --- mmm/mmmfs/util.moon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmm/mmmfs/util.moon b/mmm/mmmfs/util.moon index 2a72023..1206bb7 100644 --- a/mmm/mmmfs/util.moon +++ b/mmm/mmmfs/util.moon @@ -26,8 +26,8 @@ tourl = (path, facet) -> assert origin, "cannot resolve relative path '#{path}' without origin!" path = "#{origin.path}/#{path}" - while path\match '/([^/]-)/%.%./' - path = path\gsub '/([^/]-)/%.%./', '/' + while path\match '/([^/]-)/%.%.(%f[/\0])' + path = path\gsub '/([^/]-)/%.%.(%f[/\0])', '%2' if origin.path == path\sub 1, #origin.path assert (origin\walk path), "couldn't resolve path '#{path}' from #{origin}" -- cgit v1.2.3