From a9155afb83aff9ba4d31df635ac96708f50be2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Frinnstr=C3=B6m?= Date: Tue, 17 Nov 2020 21:18:55 +0100 Subject: [PATCH] Some small changes --- .../src/reading/tree/ZipArchiveResponse.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts b/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts index 23545cd96e..048b2ab46d 100644 --- a/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts +++ b/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts @@ -134,15 +134,15 @@ export class ZipArchiveResponse implements ReadTreeResponse { .pipe(unzipper.Parse()) .on('entry', (entry: Entry) => { if (this.shouldBeIncluded(entry)) { + const entryPath = this.getPath(entry); if (entry.type === 'Directory') { - const directoryPath = this.getPath(entry); - if (directoryPath) { - fs.mkdirSync(path.join(dir, this.getPath(entry))); + if (entryPath) { + fs.mkdirSync(path.join(dir, entryPath)); } entry.resume(); - return; + } else { + entry.pipe(fs.createWriteStream(path.join(dir, entryPath))); } - entry.pipe(fs.createWriteStream(path.join(dir, this.getPath(entry)))); } else { entry.autodrain(); }