fix(plugin): check that path is actually in root dir. Closes #2075

This commit is contained in:
Folke Lemaitre 2025-10-23 07:04:43 +02:00
commit 16e52715b7
No known key found for this signature in database
GPG key ID: 9B52594D560070AB
2 changed files with 2 additions and 2 deletions

View file

@ -240,7 +240,7 @@ function M.update_state()
if plugin.virtual then
plugin._.is_local = true
plugin._.installed = true -- local plugins are managed by the user
elseif plugin.dir:find(Config.options.root, 1, true) == 1 then
elseif plugin.dir:find(Config.options.root .. "/", 1, true) == 1 then
plugin._.installed = installed[plugin.name] ~= nil
installed[plugin.name] = nil
else

View file

@ -25,7 +25,7 @@ M.clean = {
run = function(self, opts)
opts = opts or {}
local dir = self.plugin.dir:gsub("/+$", "")
assert(dir:find(Config.options.root, 1, true) == 1, self.plugin.dir .. " should be under packpath!")
assert(dir:find(Config.options.root .. "/", 1, true) == 1, self.plugin.dir .. " should be under packpath!")
local rock_root = Config.options.rocks.root .. "/" .. self.plugin.name
if vim.uv.fs_stat(rock_root) then