Fixed an if condition

This commit is contained in:
2021-06-01 07:49:40 -07:00
parent fe63c856f3
commit 56a8165368

View File

@@ -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);