From 0c2ac83e3f6173f76a3e72c8468709ae3b146e4c Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 3 May 2024 16:04:18 -0700 Subject: [PATCH] Fix faulty chunk rounding A file with no content should be a 0 byte chunk, not 512 bytes. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 8263454..a27d778 100644 --- a/index.html +++ b/index.html @@ -97,7 +97,7 @@ buffer.push(...header); // Add the file data, with end padded to the nearest 512 byte chunk - const chunkSize = 512 * Math.ceil((file.size ? file.size : 1) / 512); + const chunkSize = 512 * Math.ceil(file.size / 512); buffer.push( ...new Uint8Array(await file.arrayBuffer()), ...'\0'.repeat(chunkSize - file.size) -- 2.47.3