From 835254c0283940eb6127aa42b49cb1850e8bc8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 20 Dec 2018 18:38:23 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=B7=AF=E5=BE=84=E8=BD=ACuri?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/workspace.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server/src') 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 -- cgit v1.2.3