diff --git a/lua/lazy/core/util.lua b/lua/lazy/core/util.lua index 9a81d28..7411664 100644 --- a/lua/lazy/core/util.lua +++ b/lua/lazy/core/util.lua @@ -175,13 +175,16 @@ function M.ls(path, fn) local handle = vim.loop.fs_scandir(path) while handle do local name, t = vim.loop.fs_scandir_next(handle) - -- HACK: assume type is a file if no type returned - -- see https://github.com/folke/lazy.nvim/issues/306 - t = t or "file" if not name then break end - if fn(path .. "/" .. name, name, t) == false then + + local fname = path .. "/" .. name + + -- HACK: type is not always returned due to a bug in luv, + -- so fecth it with fs_stat instead when needed. + -- see https://github.com/folke/lazy.nvim/issues/306 + if fn(fname, name, t or vim.loop.fs_stat(fname).type) == false then break end end