Repository navigation
fix(web): archive previews list numbered files and folders in natural order - #43701
juliusmarminge merged 2 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
EvidenceSeeded the same nine-entry ZIP and unpacked files on fresh databases, opened a Replay thread → right panel → Files, expanded unzipped/, selected book.zip, and maximized the panel. Chromium, 1440×1000, light theme on both sides.
The unpacked tree uses natural order on both builds. The scenario fails on base and passes on head; scenarios:prove exited 0. Scenario and synthetic ZIP seed · Before recording · After recording |
… order (pingdotgg#43701) Co-authored-by: Julius Marminge <julius0216@outlook.com> (cherry picked from commit 6249fe9)
… order (pingdotgg#43701) Co-authored-by: Julius Marminge <julius0216@outlook.com> (cherry picked from commit 6249fe9)
… order (pingdotgg#43701) Co-authored-by: Julius Marminge <julius0216@outlook.com> (cherry picked from commit 6249fe9)


Problem
When a
.zipor.tarholds numbered files or folders, the web archive preview lists them aspage1.txt,page10.txt,page2.txt(andch1,ch10,ch2) instead ofpage1.txt,page2.txt,page10.txt. The listing sorted names with a plainlocaleCompare, while the workspace file tree already lists numbered names in natural order and the Files breadcrumb menu and the mobile ZIP browser sort with a numeric collator.Change
The archive listing now sorts with the same
Intl.Collator(undefined, { numeric: true, sensitivity: "base" })the Files breadcrumb menu (fileBreadcrumbChildren) and the diff file tree use, created on first comparison like theirs. The comparator, folders first and then names in natural order, moves tobinaryPreviewProtocol.tsascompareArchiveRows, next to the other archive preview helpers and their tests.BinaryViewer.tsxcalls it in place of the inline sort; the rest of that diff is the formatter re-indenting the same JSX.Scope
Bug fix: wrong order in the web archive preview. It is a small fix of an obvious bug, so there is no issue. Mobile already sorts archives with a numeric collator (
apps/mobile/src/features/files/zipTree.ts), and desktop renders this same web component.Verification
Setup: Linux, web app in the Browser panel, light theme, 1280×800, fresh isolated dev data (
T3CODE_DEV_SEED=0). A demo repository holdsbook.zipwithpage1.txt,page2.txt,page10.txtand foldersch1/,ch2/,ch10/.Steps: Open the demo project → right panel → Files →
book.zip→ hide the file explorer → maximize the panel.Folders list ch1, ch10, ch2 and files page1, page10, page2
Folders list ch1, ch2, ch10 and files page1, page2, page10
The new test in
binaryPreview.worker.test.tspasses on 4d02ebd (3 of 3 runs) and fails when the comparator is swapped back to 44a5333'slocaleCompareor loses its folders-first check.vp run check:changedpasses on 4d02ebd. On main 83d4509 the test fails (no comparator there), and on a local merge of 4d02ebd into 83d4509 it passes and typecheck is clean.Not shown
.tararchive in the app: not run. It goes through the same listing and sort as.zip.Test output
4d02ebd with 44a5333's comparator (
Number(b.directory) - Number(a.directory) || a.path.localeCompare(b.path)):4d02ebd:
Generated with Claude Opus 5.5 in T3 Code Nightly