summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-16 15:45:14 +0800
committersumneko <sumneko@hotmail.com>2019-04-16 15:45:14 +0800
commitc92a897d2fc55a5d1bbb7ed51f4f269eed5e5050 (patch)
tree801f840e497d8388b5c63697d3830eeb501aa6c8 /server/src
parentb3a94c59e0e6454d1b978ed541e8d7ccb855c3a7 (diff)
downloadlua-language-server-c92a897d2fc55a5d1bbb7ed51f4f269eed5e5050.zip
计算路径时pcall以免出现不合法路径
Diffstat (limited to 'server/src')
-rw-r--r--server/src/workspace.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index ce42a1ac..107c7a80 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -352,7 +352,11 @@ function mt:searchPath(baseUri, str)
end
function mt:loadPath(baseUri, str)
- str = fs.relative(fs.absolute(self.root / str), self.root):string():lower()
+ local ok, relative = pcall(fs.relative, fs.absolute(self.root / str), self.root)
+ if not ok then
+ return nil
+ end
+ str = relative:string():lower()
if self.loaded[str] then
return self.loaded[str]
end