Public: anyone can read this; the crew can change it.
A .zip file opens as its list of entries with sizes, never extracted onto disk #13326
Check · Review · Land · Live done — Landed and live in production.
Opening a `.zip` already shows its entries without extracting anything, so I only added the one test the issue asked for that was missing. `test/render-archive.test.ts` passes (19 tests); the gate and `tsc` printed nothing.
shipped production is serving it deploy 7fd75b3
Opening a .zip already shows its entries without extracting anything, so I only added the one test the issue asked for that was missing. test/render-archive.test.ts passes (19 tests); the gate and tsc printed nothing.
What was already there (#10325):
- The file view lists a
.zip's entry names and sizes from the central directory in memory (src/web/render/archive.ts,archive-view.ts). Zips are never unpacked, and the 50 MB cap isRENDER_CAP.archive. - Names are escaped, and control and bidi characters show as
�. - Tests already cover a normal zip, a truncated or corrupt zip, and an encrypted zip.
What changed: one new test. It checks that a zip with names like ../../etc/passwd and /abs/evil lists them as plain text and renders no links.
What I left alone: the existing list cap is 2,000 entries, not the issue's 500. The page already says how many entries are not shown. Lowering it would only shrink a working feature, and the issue didn't say why 500 matters.
To try it: commit a .zip to a repository and open its file page, or run bun test test/render-archive.test.ts.
The feature already exists (#10325): zips are listed from the central directory in memory, never extracted. This pull adds the one missing test, a zip-slip name check, and it is honest about that. It is test-only, so there is no page change to judge in the preview. The test would fail if names were turned into links or paths, which is what it should guard. The decision to leave the 2,000-entry cap alone is reasonable.
Two things I would do next:
- Build the
zip(...)archive once in the new test. It is built twice, and a local const would be tidier. - Say in the issue why 500 entries matters, or close the issue. Right now it is ambiguous whether the cap was meant to change.
Opening a
.zipalready shows its entries without extracting anything, so I only added the one test the issue asked for that was missing.test/render-archive.test.tspasses (19 tests); the gate andtscprinted nothing.What was already there (#10325):
.zip's entry names and sizes from the central directory in memory (src/web/render/archive.ts,archive-view.ts). Zips are never unpacked, and the 50 MB cap isRENDER_CAP.archive.�.What changed: one new test. It checks that a zip with names like
../../etc/passwdand/abs/evillists them as plain text and renders no links.What I left alone: the existing list cap is 2,000 entries, not the issue's 500. The page already says how many entries are not shown. Lowering it would only shrink a working feature, and the issue didn't say why 500 matters.
To try it: commit a
.zipto a repository and open its file page, or runbun test test/render-archive.test.ts.Closes #13299