diff options
Diffstat (limited to 'server/src/3rd/lua-uri/uri')
-rw-r--r-- | server/src/3rd/lua-uri/uri/file/unix.lua | 2 | ||||
-rw-r--r-- | server/src/3rd/lua-uri/uri/file/win32.lua | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/src/3rd/lua-uri/uri/file/unix.lua b/server/src/3rd/lua-uri/uri/file/unix.lua index 2ffe1504..8bd4c942 100644 --- a/server/src/3rd/lua-uri/uri/file/unix.lua +++ b/server/src/3rd/lua-uri/uri/file/unix.lua @@ -18,7 +18,7 @@ function M.make_file_uri (path) error("Unix relative paths can't be converted to file URIs") end path = path:gsub("//+", "/") - path = Util.uri_encode(path, "^A-Za-z0-9%-._~!$&'()*+,;=:@/") + path = Util.uri_encode(path, "^A-Za-z0-9%-._~!$&'()*+,;=@/") return assert(URI:new("file://" .. path)) end diff --git a/server/src/3rd/lua-uri/uri/file/win32.lua b/server/src/3rd/lua-uri/uri/file/win32.lua index bdacbe15..d4e40243 100644 --- a/server/src/3rd/lua-uri/uri/file/win32.lua +++ b/server/src/3rd/lua-uri/uri/file/win32.lua @@ -19,13 +19,13 @@ function M.filesystem_path (uri) end function M.make_file_uri (path) - if path:find("^[A-Za-z]:$") then path = path .. "\\" end - local _, _, host, hostpath = path:find("^\\\\([A-Za-z.]+)\\(.*)$") + path = path:gsub("\\", "/") + if path:find("^[A-Za-z]:$") then path = path .. "/" end + local _, _, host, hostpath = path:find("^//([A-Za-z0-9.]+)/(.*)$") host = host or "" hostpath = hostpath or path - hostpath = hostpath:gsub("\\", "/") - :gsub("//+", "/") - hostpath = Util.uri_encode(hostpath, "^A-Za-z0-9%-._~!$&'()*+,;=:@/") + hostpath = hostpath:gsub("//+", "/") + hostpath = Util.uri_encode(hostpath, "^A-Za-z0-9%-._~!$&'()*+,;=@/") if not hostpath:find("^/") then hostpath = "/" .. hostpath end return assert(URI:new("file://" .. host .. hostpath)) end |