diff --git a/.changeset/nine-mails-crash.md b/.changeset/nine-mails-crash.md index ecb047802e..ead5553d1c 100644 --- a/.changeset/nine-mails-crash.md +++ b/.changeset/nine-mails-crash.md @@ -6,4 +6,4 @@ The `ZipArchiveResponse` now correctly handles corrupt ZIP archives. Before this change, certain corrupt ZIP archives either cause the inflater to throw (as expected), or will hang the parser indefinitely. -By switching out the `zip` parsing library, we now write to a temporary directory, and load from disk which should ensure that the parsing of the `.zip` files are done correctly because `streaming` of `zip` paths is technically impossible without being able to parse the headers at the end of he file. +By switching out the `zip` parsing library, we now write to a temporary directory, and load from disk which should ensure that the parsing of the `.zip` files are done correctly because `streaming` of `zip` paths is technically impossible without being able to parse the headers at the end of the file. diff --git a/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts b/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts index b25f6ad24e..1a6658b0c2 100644 --- a/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts +++ b/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts @@ -111,7 +111,8 @@ export class ZipArchiveResponse implements ReadTreeResponse { } zipfile.on('entry', async (entry: Entry) => { - if (!/\/$/.test(entry.fileName) && this.shouldBeIncluded(entry)) { + // Check that the file is not a directory, and that is matches the filter. + if (!entry.fileName.endsWith('/') && this.shouldBeIncluded(entry)) { zipfile.openReadStream(entry, async (openErr, readStream) => { if (openErr || !readStream) { reject(