Skip to content

archive: volume-aware extract/compress + friendlier errors#347

Merged
lovehunter9 merged 1 commit into
mainfrom
archive_debug
Jun 8, 2026
Merged

archive: volume-aware extract/compress + friendlier errors#347
lovehunter9 merged 1 commit into
mainfrom
archive_debug

Conversation

@lovehunter9

Copy link
Copy Markdown
Collaborator

Summary

A bundle of multi-volume archive fixes plus a CORS hole that blocked the iOS app from sending X-Archive-Password.

  • Extract / Entries / Entry: any volume the user clicks (.002, .003, ...) is now rewritten to .001 server-side, so the request resolves regardless of which volume they picked. A directory pre-scan rejects requests where an intermediate .NNN is missing (e.g. user deleted .002); a fallback map (mapExtractErr) translates 7z's raw exit status 2 into an actionable message when the missing piece is the last volume and can't be detected up front.
  • Compress rename/skip/overwrite are no longer fooled by partial volume sets: scanning any <base>.NNN numeric sibling prevents the rename path from picking a name whose .001 clashes, 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.
  • CORS Allow-Headers gains x-archive-password so the FE can send the password header across origins (capacitor / app webview).
  • 7z Classify learns three more substring patterns commonly seen on missing-volume failures, so those errors land on ErrVolumeMissing instead of the generic exit status 2 we kept seeing.

Behavior

  • Same single-volume archives behave exactly as before.
  • Errors users see for partial volume sets are now: archive volume missing: foo.zip.002 (preflight) or archive volume missing or incomplete; please ensure all parts are present (task fallback) instead of exit status 2.
  • Over-long compression names are rejected with archive name too long: N bytes (max ...) rather than failing inside 7z.

Test plan

  • Right-click .001, .002, .003 of a 4-volume zip → all three trigger extract identically.
  • Delete .002; right-click any volume → 400 archive volume missing: ...zip.002 (preflight catches it).
  • Delete the last volume; right-click any → task fails with the friendly message.
  • Compress test.zip to a directory containing test.zip.001..004 (or only .002) with conflict=rename → output goes to test (1).zip.001.. and the original volumes stay intact.
  • Compress with conflict=skip on a directory holding any <base>.NNN → task returns immediately, no work done.
  • Compress with conflict=overwrite → all existing <base>.NNN are backed up to .bak.<taskid> and restored on cancel/failure.
  • iOS LarePass (Origin: capacitor://localhost) sending X-Archive-Password no longer trips CORS.

Made with Cursor

- 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>
@lovehunter9 lovehunter9 merged commit cb3010d into main Jun 8, 2026
1 check failed
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