Skip to content

Commit

Permalink
fix(cache): hack to work around plugins trying to load relatve modules.
Browse files Browse the repository at this point in the history
Fixes #543
  • Loading branch information
folke committed Feb 15, 2023
1 parent 4a0857c commit e916f41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/lazy/core/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ function Cache.find(modname, opts)
modname = modname:gsub("/", ".")
local basename = modname:gsub("%.", "/")
local idx = modname:find(".", 1, true)

-- HACK: some plugins try to load invalid relative paths (see #543)
if idx == 1 then
modname = modname:gsub("^%.+", "")
basename = modname:gsub("%.", "/")
idx = modname:find(".", 1, true)
end

local topmod = idx and modname:sub(1, idx - 1) or modname

-- OPTIM: search for a directory first when topmod == modname
Expand Down

0 comments on commit e916f41

Please sign in to comment.