Skip to content

Commit 6ae25da

Browse files
authored
fix(filesystem): proper item creation for links (#1856)
1 parent 54435a6 commit 6ae25da

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lua/neo-tree/sources/common/file-items.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function create_item(context, path, _type, bufnr)
172172
end
173173

174174
if _type == nil then
175-
local stat = uv.fs_stat(path)
175+
local stat = uv.fs_lstat(path)
176176
_type = stat and stat.type or "unknown"
177177
end
178178
local revealing_path = utils.truthy(context.path_to_reveal)
@@ -195,8 +195,11 @@ function create_item(context, path, _type, bufnr)
195195
---@cast item neotree.FileItem.Link
196196
item.is_link = true
197197
item.link_to = uv.fs_readlink(path)
198-
if item.link_to ~= nil then
199-
item.type = uv.fs_stat(item.link_to).type
198+
if item.link_to then
199+
local link_to_stat = uv.fs_stat(item.path)
200+
if link_to_stat then
201+
item.type = link_to_stat.type
202+
end
200203
end
201204
end
202205
if item.type == "directory" then

0 commit comments

Comments
 (0)