fix(extract): replace os.rename with fs.rename for UTF-8 path support

- Replace os.rename() with fs.rename() to properly handle UTF-8 characters in file paths on Windows (e.g., José, München, 北京)
- Remove unnecessary tostring() conversions as fs.rename() accepts Url objects

Fixes extraction failures when target paths contain non-ASCII characters on Windows systems.
This commit is contained in:
Ciarán O'Brien 2026-01-24 02:38:59 +00:00
parent 49b8324bbf
commit 45c083f434

View file

@ -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