diff options
author | E. Westbrook <github@westbrook.io> | 2018-08-21 12:42:26 -0600 |
---|---|---|
committer | E. Westbrook <github@westbrook.io> | 2018-08-21 12:43:30 -0600 |
commit | 043e99771352aff47680b99f09b66a32f0cc3ef5 (patch) | |
tree | cf5a837a349305ad10b54d1ce152e7cdc490edfc | |
parent | ca5398be098b571912dcbd93c83ab78151814f99 (diff) | |
download | luasocket-043e99771352aff47680b99f09b66a32f0cc3ef5.tar.gz luasocket-043e99771352aff47680b99f09b66a32f0cc3ef5.tar.bz2 luasocket-043e99771352aff47680b99f09b66a32f0cc3ef5.zip |
url.lua:remove_dot_components(): avoid ambiguous numeric representation as empty-path-segment marker
-rw-r--r-- | src/url.lua | 5 |
1 files 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 | |||
83 | -- Returns | 83 | -- Returns |
84 | -- dot-normalized path | 84 | -- dot-normalized path |
85 | local function remove_dot_components(path) | 85 | local function remove_dot_components(path) |
86 | local marker = string.char(1) | ||
86 | repeat | 87 | repeat |
87 | local was = path | 88 | local was = path |
88 | path = path:gsub('//', '/'..0x00..'/', 1) | 89 | path = path:gsub('//', '/'..marker..'/', 1) |
89 | until path == was | 90 | until path == was |
90 | repeat | 91 | repeat |
91 | local was = path | 92 | local was = path |
@@ -99,7 +100,7 @@ local function remove_dot_components(path) | |||
99 | path = path:gsub('/%.%.$', '/') | 100 | path = path:gsub('/%.%.$', '/') |
100 | path = path:gsub('/%.$', '/') | 101 | path = path:gsub('/%.$', '/') |
101 | path = path:gsub('^/%.%./', '/') | 102 | path = path:gsub('^/%.%./', '/') |
102 | path = path:gsub(0x00, '') | 103 | path = path:gsub(marker, '') |
103 | return path | 104 | return path |
104 | end | 105 | end |
105 | 106 | ||