Repository navigation
feat(media): import many images from one .zip - #1127
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
(
__MACOSX/, dot-files) are left alone.stored bytes are already there counts as "already in the library".
logo-2.svg), thesingle-upload rule: an image in use is never replaced.
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:
zip9.8 with onlydeflate-flate2(the flate2 alreadyin 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