···268 // Allow up to 100MB per file blob, with 2 minute timeout
269 let content = await safeFetchBlob(blobUrl, { maxSize: 100 * 1024 * 1024, timeout: 120000 });
270271- // If content is base64-encoded, decode it back to gzipped binary
272- if (base64 && encoding === 'gzip') {
273- // Convert Uint8Array to Buffer for proper string conversion
274 const buffer = Buffer.from(content);
275- const base64String = buffer.toString('utf-8');
276 content = Buffer.from(base64String, 'base64');
277 }
278
···268 // Allow up to 100MB per file blob, with 2 minute timeout
269 let content = await safeFetchBlob(blobUrl, { maxSize: 100 * 1024 * 1024, timeout: 120000 });
270271+ // If content is base64-encoded, decode it back to binary (gzipped or not)
272+ if (base64) {
273+ // The content from the blob is base64 text, decode it directly to binary
274 const buffer = Buffer.from(content);
275+ const base64String = buffer.toString('ascii'); // Use ascii for base64 text, not utf-8
276 content = Buffer.from(base64String, 'base64');
277 }
278