diff --git a/yazi-plugin/preset/plugins/extract.lua b/yazi-plugin/preset/plugins/extract.lua index d271f3cd..13a5cf2c 100644 --- a/yazi-plugin/preset/plugins/extract.lua +++ b/yazi-plugin/preset/plugins/extract.lua @@ -99,11 +99,17 @@ function M:tidy(from, to, tmp) fail("Failed to determine a target for '%s'", from) end - target = tostring(target) - if only and not os.rename(tostring(outs[1].url), target) then - fail('Failed to move "%s" to "%s"', outs[1].url, target) - elseif not only and not os.rename(tostring(tmp), target) then - fail('Failed to move "%s" to "%s"', tmp, target) + local move + if only then + move = fs.rename(outs[1].url, target) + if not move then + fail('Failed to move "%s"', outs[1].url) + end + else + move = fs.rename(tmp, target) + if not move then + fail('Failed to move "%s"', tmp) + end end fs.remove("dir", tmp) end