From 043e99771352aff47680b99f09b66a32f0cc3ef5 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Tue, 21 Aug 2018 12:42:26 -0600 Subject: [PATCH] url.lua:remove_dot_components(): avoid ambiguous numeric representation as empty-path-segment marker --- src/url.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/url.lua b/src/url.lua index 466d4fa..0a3a80a 100644 --- a/src/url.lua +++ b/src/url.lua @@ -83,9 +83,10 @@ end -- Returns -- dot-normalized path local function remove_dot_components(path) + local marker = string.char(1) repeat local was = path - path = path:gsub('//', '/'..0x00..'/', 1) + path = path:gsub('//', '/'..marker..'/', 1) until path == was repeat local was = path @@ -99,7 +100,7 @@ local function remove_dot_components(path) path = path:gsub('/%.%.$', '/') path = path:gsub('/%.$', '/') path = path:gsub('^/%.%./', '/') - path = path:gsub(0x00, '') + path = path:gsub(marker, '') return path end