From 56a8165368f01d9fc5c8c160fa50c45adda477e0 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Tue, 1 Jun 2021 07:49:40 -0700 Subject: [PATCH] Fixed an if condition --- utils/uncompression.utils.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/utils/uncompression.utils.ts b/utils/uncompression.utils.ts index 7ece6e8..6e19399 100644 --- a/utils/uncompression.utils.ts +++ b/utils/uncompression.utils.ts @@ -183,9 +183,6 @@ export const unzip = async ( }; const paths = constructPaths(extractionOptions, walkedFolder); const extractedFiles: IExtractedComicBookCoverFile[] = []; - const isCover = - extractedFiles.length === 1 && - extractionOptions.extractTarget === "cover"; try { await fse.ensureDir(paths.targetPath, directoryOptions); @@ -200,7 +197,10 @@ export const unzip = async ( for await (const entry of zip) { const fileName = explodePath(entry.path).fileName; const size = entry.vars.uncompressedSize; - if (isCover) { + if ( + extractedFiles.length === 1 && + extractionOptions.extractTarget === "cover" + ) { break; } if (fileName !== "" && entry.type !== "Directory") { @@ -217,7 +217,10 @@ export const unzip = async ( return new Promise(async (resolve, reject) => { logger.info(""); - if (isCover) { + if ( + extractedFiles.length === 1 && + extractionOptions.extractTarget === "cover" + ) { resolve(extractedFiles[0]); } else { resolve(extractedFiles);