chore: refactor and comment

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-07-25 13:53:54 +02:00
parent 01d825ba28
commit 764ba707a2
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -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.
@@ -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(