From: Ardis Lu Date: Fri, 3 May 2024 23:04:18 +0000 (-0700) Subject: Fix faulty chunk rounding X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=0c2ac83e3f6173f76a3e72c8468709ae3b146e4c;p=targz Fix faulty chunk rounding A file with no content should be a 0 byte chunk, not 512 bytes. --- 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)