mirror of
https://github.com/LisherSong/ps5-web-file-manager.git
synced 2026-10-06 12:00:26 +02:00
User reported FTP-upload-and-extract use case: after uploading .part01.rar..part05.rar via FTP, the extract button should appear on selection just like .zip already does, alongside the existing delete / copy / move / rename buttons in the toolbar. Changes are purely client-side. The extractBtn sits next to deleteBtn in the toolbar (HTML layout unchanged). New helpers: - isRarMainVolume(item): matches bare .rar AND .part01.rar/.part1.rar / .part001.rar, but excludes any .partNN.rar (those are sub-volumes) - isRarSubVolume(item): matches .part02+.rar (the non-first parts) - isExtractableArchive(item): .zip OR rar main volume renderExtractButton rewiring: - archives.length + subs.length both zero -> hidden (unchanged default) - only subs selected -> button visible but disabled with tooltip 'select the main volume (.rar or .part01.rar)' (new i18n keys) - exactly one archive selected -> button enabled with hover target actionExtract wired to the new isExtractableArchive filter, keeping the existing 'must be exactly 1 selected' guard so multi-select still no-ops cleanly. Caught a real bug while wiring: the first version of isRarMainVolume matched /\.rar$/ before the part01 check, so part02+ was incorrectly classified as a main volume. Fixed by reordering + adding negative sub-pattern so .partNN. never trips the bare-.rar rule. Two new i18n keys (zh + en): - extractSelectMainVolume: friendly message when user picks only sub-volumes - extractArchivePending: reserved for the future RAR password prompt 10/10 unit cases pass for the detection regexes (zip / .rar / .part01.rar / .part02.rar / .tar.gz / .bin). Backend support for RAR is not part of this commit; clicking Extract on a .rar on v1.7 still returns err_extract_unsupported from the existing zip_extract pipeline. That will swap to the unrar engine in v1.8 without any further frontend work. Also sets local repo core.autocrlf=false to keep JS files LF on this Windows dev machine (global autocrlf was rewriting them as CRLF on write and causing the whole file to show up as changed on every edit).