archive: volume-aware extract/compress + friendlier errors#347
Merged
Conversation
- extract/entries/entry: rewrite .NNN+ src to .001; precheck for missing intermediate volumes; map 7z extract failures to actionable messages. - compress: rename/skip/overwrite scan any <base>.NNN sibling so partial volume sets don't slip past; reject over-long basenames against NAME_MAX. - CORS Allow-Headers gains x-archive-password so the password header can cross origins. Co-authored-by: Cursor <cursoragent@cursor.com>
e5137a5 to
96e8ba6
Compare
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.
Summary
A bundle of multi-volume archive fixes plus a CORS hole that blocked the iOS app from sending
X-Archive-Password..002,.003, ...) is now rewritten to.001server-side, so the request resolves regardless of which volume they picked. A directory pre-scan rejects requests where an intermediate.NNNis missing (e.g. user deleted.002); a fallback map (mapExtractErr) translates 7z's rawexit status 2into an actionable message when the missing piece is the last volume and can't be detected up front.<base>.NNNnumeric sibling prevents the rename path from picking a name whose.001clashes, the skip path from missing existing.002, and the overwrite path from leaving stray volumes behind. Basenames are also gated against POSIX NAME_MAX (255) before the task runs, so over-long names fail fast rather than blowing up multi-volume tmp paths mid-write.x-archive-passwordso the FE can send the password header across origins (capacitor / app webview).Classifylearns three more substring patterns commonly seen on missing-volume failures, so those errors land onErrVolumeMissinginstead of the genericexit status 2we kept seeing.Behavior
archive volume missing: foo.zip.002(preflight) orarchive volume missing or incomplete; please ensure all parts are present(task fallback) instead ofexit status 2.archive name too long: N bytes (max ...)rather than failing inside 7z.Test plan
.001,.002,.003of a 4-volume zip → all three trigger extract identically..002; right-click any volume →400 archive volume missing: ...zip.002(preflight catches it).test.zipto a directory containingtest.zip.001..004(or only.002) with conflict=rename → output goes totest (1).zip.001..and the original volumes stay intact.<base>.NNN→ task returns immediately, no work done.<base>.NNNare backed up to.bak.<taskid>and restored on cancel/failure.Origin: capacitor://localhost) sendingX-Archive-Passwordno longer trips CORS.Made with Cursor