We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 543ed3c commit 3886617Copy full SHA for 3886617
lua/nvim-tree/actions/fs/remove-file.lua
@@ -71,9 +71,14 @@ local function remove_dir(cwd)
71
72
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
73
local stat = vim.loop.fs_stat(new_cwd)
74
+ ---@diagnostic disable-next-line: param-type-mismatch
75
+ local lstat = vim.loop.fs_lstat(new_cwd)
76
+
77
local type = stat and stat.type or nil
78
+ -- Checks if file is a link file to ensure deletion of the symlink instead of the file it points to
79
+ local ltype = lstat and lstat.type or nil
80
- if type == "directory" then
81
+ if type == "directory" and ltype ~= "link" then
82
local success = remove_dir(new_cwd)
83
if not success then
84
return false
0 commit comments