From 45c083f434be007e5d555ffbbbed2d691c498bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20O=27Brien?= Date: Sat, 24 Jan 2026 02:38:59 +0000 Subject: [PATCH] fix(extract): replace os.rename with fs.rename for UTF-8 path support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- yazi-plugin/preset/plugins/extract.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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