mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
url.lua:remove_dot_components(): avoid ambiguous numeric representation as empty-path-segment marker
This commit is contained in:
parent
ca5398be09
commit
043e997713
@ -83,9 +83,10 @@ end
|
|||||||
-- Returns
|
-- Returns
|
||||||
-- dot-normalized path
|
-- dot-normalized path
|
||||||
local function remove_dot_components(path)
|
local function remove_dot_components(path)
|
||||||
|
local marker = string.char(1)
|
||||||
repeat
|
repeat
|
||||||
local was = path
|
local was = path
|
||||||
path = path:gsub('//', '/'..0x00..'/', 1)
|
path = path:gsub('//', '/'..marker..'/', 1)
|
||||||
until path == was
|
until path == was
|
||||||
repeat
|
repeat
|
||||||
local was = path
|
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('/%.$', '/')
|
||||||
path = path:gsub('^/%.%./', '/')
|
path = path:gsub('^/%.%./', '/')
|
||||||
path = path:gsub(0x00, '')
|
path = path:gsub(marker, '')
|
||||||
return path
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user