diff options
author | E. Westbrook <github@westbrook.io> | 2018-08-21 09:59:45 -0600 |
---|---|---|
committer | E. Westbrook <github@westbrook.io> | 2018-08-21 09:59:45 -0600 |
commit | 7ccea58776b8084f29a48610cb44b17ca604e4b5 (patch) | |
tree | 72dfafe326432f522be33b54170e92d7c4c9a382 /src | |
parent | c570a32c219c957fd405ed018f2500f06952c043 (diff) | |
download | luasocket-7ccea58776b8084f29a48610cb44b17ca604e4b5.tar.gz luasocket-7ccea58776b8084f29a48610cb44b17ca604e4b5.tar.bz2 luasocket-7ccea58776b8084f29a48610cb44b17ca604e4b5.zip |
url.lua:remove_dot_components(): avoid overconsuming dot segments
Diffstat (limited to 'src')
-rw-r--r-- | src/url.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/url.lua b/src/url.lua index 0d88adb..e1fa2bc 100644 --- a/src/url.lua +++ b/src/url.lua | |||
@@ -85,11 +85,11 @@ end | |||
85 | local function remove_dot_components(path) | 85 | local function remove_dot_components(path) |
86 | repeat | 86 | repeat |
87 | local was = path | 87 | local was = path |
88 | path = path:gsub('/%./', '/') | 88 | path = path:gsub('/%./', '/', 1) |
89 | until path == was | 89 | until path == was |
90 | repeat | 90 | repeat |
91 | local was = path | 91 | local was = path |
92 | path = path:gsub('[^/]+/%.%./([^/]+)', '%1') | 92 | path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1) |
93 | until path == was | 93 | until path == was |
94 | path = path:gsub('[^/]+/%.%./*$', '') | 94 | path = path:gsub('[^/]+/%.%./*$', '') |
95 | path = path:gsub('/%.%.$', '/') | 95 | path = path:gsub('/%.%.$', '/') |