mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
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:
parent
49b8324bbf
commit
45c083f434
1 changed files with 11 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue