mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Adds /./ to normalize_path. Closes #920
This commit is contained in:
parent
30f0fab5bc
commit
21992c9c7c
1 changed files with 3 additions and 1 deletions
|
|
@ -108,10 +108,12 @@ local function get_file_extension(f)
|
|||
return string.match(f, ".-/.-%.([^/%.]*)$") or "Other"
|
||||
end
|
||||
|
||||
-- removes /../ from paths; for example
|
||||
-- removes /../ and /./ from paths; for example
|
||||
-- normalize_path("/a/v/../../da/as/d/a/a/aa/../") -> "/da/as/d/a/a/"
|
||||
local function normalize_path(p)
|
||||
local n=0
|
||||
p = p:gsub("/%.%f[/]", "")
|
||||
p = p:gsub("/%.$", "/")
|
||||
repeat
|
||||
p, n = string.gsub(p, "/[^/]-/%.%.", "")
|
||||
until n==0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue