From 10dd559c0e3b94040e1a545ee8b1c4077ec09ceb Mon Sep 17 00:00:00 2001 From: riz Date: Wed, 19 Nov 2025 22:45:17 +0000 Subject: [PATCH] Fix ZIP parser to read file sizes from central directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- pkgs/utils/deploy.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/utils/deploy.ts b/pkgs/utils/deploy.ts index 0f2ee79..862ed25 100644 --- a/pkgs/utils/deploy.ts +++ b/pkgs/utils/deploy.ts @@ -409,12 +409,11 @@ export const deploy = { const fileNameBytes = new Uint8Array(buffer.buffer, centralDirOffset + centralDirPos + 46, fileNameLength); const filename = new TextDecoder().decode(fileNameBytes); - // Get file size info from local header - const localHeaderView = new DataView(buffer.buffer, localHeaderOffset, 30); - const compressedSize = localHeaderView.getUint32(18, true); - const uncompressedSize = localHeaderView.getUint32(22, true); - const fileNameLength2 = localHeaderView.getUint16(26, true); - const extraFieldLength2 = localHeaderView.getUint16(28, true); + // Get file size info from central directory (more reliable than local header) + const compressedSize = centralDirView.getUint32(centralDirPos + 20, true); + const uncompressedSize = centralDirView.getUint32(centralDirPos + 24, true); + const fileNameLength2 = centralDirView.getUint16(centralDirPos + 28, true); + const extraFieldLength2 = centralDirView.getUint16(centralDirPos + 30, true); entries.push({ filename,