chore: destroy dummy nodes and prevent empty paths nodes parsing

This commit is contained in:
uanela
2026-06-25 10:14:57 +02:00
parent 4fcbafea04
commit 4b13775b45

View File

@@ -330,12 +330,14 @@ function Clipboard:get_nodes_from_reg()
local absolute_paths = vim.split(content:sub(1, #content), "\n")
for _, absolute_path in ipairs(absolute_paths) do
local node_args = { absolute_path = absolute_path, name = vim.fn.fnamemodify(absolute_path, ":t"), explorer = self.explorer }
if absolute_path:sub(-1) == "/" then
node_args.name = vim.fn.fnamemodify(absolute_path:sub(1, -2), ":t")
table.insert(nodes, DirectoryNode(node_args))
else
table.insert(nodes, FileNode(node_args))
if absolute_path:match("^%s*(.-)%s*s") then
local node_args = { absolute_path = absolute_path, name = vim.fn.fnamemodify(absolute_path, ":t"), explorer = self.explorer }
if absolute_path:sub(-1) == "/" then
node_args.name = vim.fn.fnamemodify(absolute_path:sub(1, -2), ":t")
table.insert(nodes, DirectoryNode(node_args))
else
table.insert(nodes, FileNode(node_args))
end
end
end
return nodes
@@ -397,6 +399,10 @@ function Clipboard:do_paste(node, action, action_fn)
else
self:finish_paste(action)
end
for _, n in ipairs(clip) do
n:destroy()
end
end
---@param source string