Skip to content

Commit ec5d41f

Browse files
authored
Merge branch 'master' into 2826-remove-view-globals
2 parents 5737649 + 10db694 commit ec5d41f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/nvim-tree/actions/fs/remove-file.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,16 @@ local function remove_dir(cwd)
7171

7272
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
7373
local stat = vim.loop.fs_stat(new_cwd)
74+
-- TODO remove once 0.12 is the minimum neovim version
75+
-- path incorrectly specified as an integer, fixed upstream for neovim 0.12 https://github.com/neovim/neovim/pull/33872
76+
---@diagnostic disable-next-line: param-type-mismatch
77+
local lstat = vim.loop.fs_lstat(new_cwd)
78+
7479
local type = stat and stat.type or nil
80+
-- Checks if file is a link file to ensure deletion of the symlink instead of the file it points to
81+
local ltype = lstat and lstat.type or nil
7582

76-
if type == "directory" then
83+
if type == "directory" and ltype ~= "link" then
7784
local success = remove_dir(new_cwd)
7885
if not success then
7986
return false

0 commit comments

Comments
 (0)