fix(zip): do not run unzip from the current directory

Problem:
Windows searches the current directory before $PATH, so opening an archive
in a directory that also contains an `unzip` executable runs that one. The
legacy plugin refused this; the port dropped the check.

Solution:
Refuse to run `unzip` when it resolves to the current directory.
This commit is contained in:
Barrett Ruth
2026-07-31 23:52:00 -05:00
parent 794886aae7
commit 8787b8b9b6

View File

@@ -10,6 +10,11 @@ local function unzip()
if command == '' then
return nil, 'unzip executable not found'
end
-- Windows searches the current directory before $PATH, so an archive could be opened with an
-- `unzip` shipped next to it.
if vim.fs.dirname(vim.fs.normalize(command)) == vim.fs.normalize(vim.fn.getcwd()) then
return nil, 'refusing to run unzip from the current directory'
end
return command
end