Fix ZIP parser to read file sizes from central directory
- Fix compressed/uncompressed size reading from central directory instead of local header - All files now show correct sizes instead of 0 bytes - metadata.json correctly identified as 635MB (very large) - ZIP parser now working properly with Bun-compatible implementation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
2bd87e614d
commit
10dd559c0e
|
|
@ -409,12 +409,11 @@ export const deploy = {
|
||||||
const fileNameBytes = new Uint8Array(buffer.buffer, centralDirOffset + centralDirPos + 46, fileNameLength);
|
const fileNameBytes = new Uint8Array(buffer.buffer, centralDirOffset + centralDirPos + 46, fileNameLength);
|
||||||
const filename = new TextDecoder().decode(fileNameBytes);
|
const filename = new TextDecoder().decode(fileNameBytes);
|
||||||
|
|
||||||
// Get file size info from local header
|
// Get file size info from central directory (more reliable than local header)
|
||||||
const localHeaderView = new DataView(buffer.buffer, localHeaderOffset, 30);
|
const compressedSize = centralDirView.getUint32(centralDirPos + 20, true);
|
||||||
const compressedSize = localHeaderView.getUint32(18, true);
|
const uncompressedSize = centralDirView.getUint32(centralDirPos + 24, true);
|
||||||
const uncompressedSize = localHeaderView.getUint32(22, true);
|
const fileNameLength2 = centralDirView.getUint16(centralDirPos + 28, true);
|
||||||
const fileNameLength2 = localHeaderView.getUint16(26, true);
|
const extraFieldLength2 = centralDirView.getUint16(centralDirPos + 30, true);
|
||||||
const extraFieldLength2 = localHeaderView.getUint16(28, true);
|
|
||||||
|
|
||||||
entries.push({
|
entries.push({
|
||||||
filename,
|
filename,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue