]> git.ardis.lu - targz/commitdiff
Fix faulty chunk rounding
authorArdis Lu <ardisglu@gmail.com>
Fri, 3 May 2024 23:04:18 +0000 (16:04 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 3 May 2024 23:04:18 +0000 (16:04 -0700)
A file with no content should be a 0 byte chunk, not 512 bytes.

index.html

index 82634543ca9074b91abc6cd8471510a7833d9278..a27d778353716a83fb92b3b4b869fa1427f403b4 100644 (file)
@@ -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)
This page took 0.033558 seconds and 4 git commands to generate.