mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* fix(daemon): unbreak Claude Design ZIP import on Node 24 and raise file ceiling
- Skip inflateRawSync when an entry's central-directory uncompressedSize is 0;
Node 24 rejects { maxOutputLength: 0 } with ERR_OUT_OF_RANGE, which silently
killed the entire import for any zip containing an empty file or a streaming
entry whose size is only present in the data descriptor.
- Raise MAX_FILES from 500 to 5000. Real-world design-system exports commonly
exceed 500 files; MAX_TOTAL_BYTES (100 MB) and MAX_FILE_BYTES (25 MB) already
cap pathological inputs.
- Add regression tests for both: zero-byte deflate entry, central directory
advertising uncompressedSize=0, and a 600-file zip.
Refs #590
* fix(daemon): preserve real payload when central uncompressedSize is 0
Reviewers correctly flagged that the previous Buffer.alloc(0) fast-path
trusted the central directory's uncompressedSize, which is unreliable for
streaming/data-descriptor zips: an entry whose central record reports 0
can still carry real deflated bytes. The earlier fix wrote empty files to
disk in that case, and the post-condition body.length !== uncompressedSize
check still passed because both sides were 0.
- Inflate streaming entries with maxOutputLength = MAX_FILE_BYTES when the
central directory advertises 0, so legitimate non-empty payloads decode
fully instead of being silently truncated.
- Move size enforcement post-decode: per-file and total-byte budgets are now
computed from the actual decoded length, and the strict equality check is
skipped when central was 0 (i.e., genuinely unknown).
- Keep the empty-deflate degenerate case (compressed.length === 0) safe by
short-circuiting before zlib instead of relying on uncompressedSize.
Tests:
- New: streaming-zip case with central uncompressedSize=0 + non-empty body
asserts the on-disk file matches the original bytes (would have been
silently truncated under the previous fix).
- New: oversized streaming entry (> MAX_FILE_BYTES) is still rejected even
though the central directory under-reports.
- The original 0-byte and >500-file regressions remain covered.
|
||
|---|---|---|
| .. | ||
| daemon | ||
| desktop | ||
| landing-page | ||
| packaged | ||
| web | ||
| AGENTS.md | ||