From ca5398be098b571912dcbd93c83ab78151814f99 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Tue, 21 Aug 2018 12:02:25 -0600 Subject: url.lua:remove_dot_components(): use temporary NUL marker to reduce empty-segment special-case code --- src/url.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/url.lua b/src/url.lua index 10a9d90..466d4fa 100644 --- a/src/url.lua +++ b/src/url.lua @@ -85,11 +85,11 @@ end local function remove_dot_components(path) repeat local was = path - path = path:gsub('/%./', '/', 1) + path = path:gsub('//', '/'..0x00..'/', 1) until path == was repeat local was = path - path = path:gsub('//%.%./([^/]+)', '/%1', 1) + path = path:gsub('/%./', '/', 1) until path == was repeat local was = path @@ -99,6 +99,7 @@ local function remove_dot_components(path) path = path:gsub('/%.%.$', '/') path = path:gsub('/%.$', '/') path = path:gsub('^/%.%./', '/') + path = path:gsub(0x00, '') return path end -- cgit v1.2.3-55-g6feb