From 7518f7629987c69360e5a08b06d162f97c5d2dbe Mon Sep 17 00:00:00 2001 From: Cafe137 Date: Mon, 16 Sep 2024 18:16:13 +0200 Subject: [PATCH 1/2] fix: allow collection items with zero size --- src/utils/collection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/collection.ts b/src/utils/collection.ts index f8d397d7..8c54e85c 100644 --- a/src/utils/collection.ts +++ b/src/utils/collection.ts @@ -6,7 +6,7 @@ export function isCollection(data: unknown): data is Collection { return false } - return data.every(entry => typeof entry === 'object' && entry.path && entry.size) + return data.every(entry => typeof entry === 'object' && entry.path && entry.size !== undefined) } export function assertCollection(data: unknown): asserts data is Collection { From 00da866bbd73fc996af529b5afb036ebadc47353 Mon Sep 17 00:00:00 2001 From: Cafe137 Date: Mon, 16 Sep 2024 18:18:39 +0200 Subject: [PATCH 2/2] style: add newline --- src/utils/tar.browser.ts | 1 + src/utils/tar.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/utils/tar.browser.ts b/src/utils/tar.browser.ts index 680db160..d7c2d57e 100644 --- a/src/utils/tar.browser.ts +++ b/src/utils/tar.browser.ts @@ -25,6 +25,7 @@ export class TarStream { async endFile() { const padding = this.currentFileSize % 512 === 0 ? 0 : 512 - (this.currentFileSize % 512) + if (padding > 0) { this.pieces.push(new Uint8Array(padding)) } diff --git a/src/utils/tar.ts b/src/utils/tar.ts index 045a7c8e..4602b4cf 100644 --- a/src/utils/tar.ts +++ b/src/utils/tar.ts @@ -25,6 +25,7 @@ export class TarStream { async endFile() { const padding = this.currentFileSize % 512 === 0 ? 0 : 512 - (this.currentFileSize % 512) + if (padding > 0) { this.output.write(Buffer.alloc(padding, 0)) }