Skip to content

feat(media): import many images from one .zip - #1127

Merged
milkway merged 2 commits into
mainfrom
feat/media-zip-import
Nov 20, 2026
Merged

milkway merged 2 commits into
mainfrom
feat/media-zip-import

Conversation

@milkway

@milkway milkway commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

The Media page gets an "Import ZIP" button: one archive, and every SVG,
PNG, JPEG or WebP in it goes through the same pipeline as a single upload.

  • Folders are ignored (the library is flat); non-images and system litter
    (__MACOSX/, dot-files) are left alone.
  • Sending the same archive again adds nothing: a file whose name and
    stored bytes are already there counts as "already in the library".
  • A same-named file with different content keeps both (logo-2.svg), the
    single-upload rule: an image in use is never replaced.
  • One bad file does not stop the rest; it is reported by name.
  • The archive is untrusted: sizes are measured while reading (per-file
    cap = the single-upload limit, 128 MB total, 2000 entries, 64 MB sent),
    paths never reach a file system, and only image extensions are
    decompressed.

New dependency: zip 9.8 with only deflate-flate2 (the flate2 already
in the tree). Editor-gated like every other write to the library.

Checked for real: 281 SVGs (31 MB unpacked, 11 MB zip) imported in about
a second; a second run reported all 281 as already there.

🤖 Generated with Claude Code

milkway and others added 2 commits November 20, 2026 09:36
The Media page gets an "Import ZIP" button: one archive, and every SVG,
PNG, JPEG or WebP in it goes through the same pipeline as a single upload.

- Folders are ignored (the library is flat); non-images and system litter
  (`__MACOSX/`, dot-files) are left alone.
- Sending the same archive again adds nothing: a file whose name and
  stored bytes are already there counts as "already in the library".
- A same-named file with different content keeps both (`logo-2.svg`), the
  single-upload rule: an image in use is never replaced.
- One bad file does not stop the rest; it is reported by name.
- The archive is untrusted: sizes are measured while reading (per-file
  cap = the single-upload limit, 128 MB total, 2000 entries, 64 MB sent),
  paths never reach a file system, and only image extensions are
  decompressed.

New dependency: `zip` 9.8 with only `deflate-flate2` (the flate2 already
in the tree). Editor-gated like every other write to the library.

Checked for real: 281 SVGs (31 MB unpacked, 11 MB zip) imported in about
a second; a second run reported all 281 as already there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the image job budget

Automated security review of the first commit:

- An entry skipped for being over the per-file cap did not spend the
  archive's budget, so many oversized entries made the server inflate far
  more than 128 MB, one skipped entry at a time. Every byte inflated now
  counts, and no read asks for more than what is left of the budget.
- The extraction ran on a bare blocking task, outside the shared budget of
  image jobs. It now runs under it, and one batch import runs at a time
  (the archive and its files sit in memory until stored). The body is
  passed on without an extra copy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@milkway
milkway merged commit 4b1cc6b into main Nov 20, 2026
8 checks passed
@milkway
milkway deleted the feat/media-zip-import branch November 20, 2026 12:45
@milkway milkway mentioned this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant