fix(cache): hack to work around plugins trying to load relatve modules. Fixes #543

This commit is contained in:
Folke Lemaitre 2023-02-15 18:19:57 +01:00
parent 4a0857cc23
commit e916f41df2
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 8 additions and 0 deletions

View File

@ -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