diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 18:38:23 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 18:38:23 +0800 |
commit | 835254c0283940eb6127aa42b49cb1850e8bc8b6 (patch) | |
tree | 514dbe200cc34fa0332625dd08934c8359734da0 /server/src | |
parent | 99a2b022c46c713c14513fc24c79915fb256d8b7 (diff) | |
download | lua-language-server-835254c0283940eb6127aa42b49cb1850e8bc8b6.zip |
修正路径转uri的bug
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/workspace.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/workspace.lua b/server/src/workspace.lua index d14ad5d8..23b79525 100644 --- a/server/src/workspace.lua +++ b/server/src/workspace.lua @@ -28,8 +28,12 @@ local function uriEncode(path) local names = {} local cur = fs.absolute(path) while true do - local name = cur:filename():string():gsub([=[[^%w%-%_%.%~]]=], function (char) - return '%' .. string.byte(char) + local name = cur:filename():string() + if name == '' then + name = cur:string() + end + name = name:gsub([=[[^%w%-%_%.%~]]=], function (char) + return ('%02X'):format(string.byte(char)) end) table.insert(names, 1, name) if cur == cur:parent_path() then |