Skip to content

Commit

Permalink
fix: prevent dirname returning '/' if path is empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-x authored Jul 3, 2021
1 parent afc3655 commit 0b9df63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/lspconfig/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ M.path = (function()
local strip_dir_pat = path_sep.."([^"..path_sep.."]+)$"
local strip_sep_pat = path_sep.."$"
dirname = function(path)
if not path then return end
if not path or #path == 0 then
return
end
local result = path:gsub(strip_sep_pat, ""):gsub(strip_dir_pat, "")
if #result == 0 then
return "/"
Expand Down

0 comments on commit 0b9df63

Please sign in to comment.