From 1fab50a92a4d025ebd0899aadcf207ec4d2049e9 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Thu, 28 Apr 2022 22:37:31 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Refactored=20bulk=20unzip=20endp?= =?UTF-8?q?oint=20wired=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/actions/fileops.actions.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/client/actions/fileops.actions.tsx b/src/client/actions/fileops.actions.tsx index c6e142a..93249d1 100644 --- a/src/client/actions/fileops.actions.tsx +++ b/src/client/actions/fileops.actions.tsx @@ -32,6 +32,7 @@ import { SS_SEARCH_FAILED, } from "../constants/action-types"; import { success } from "react-notification-system-redux"; +import { removeLeadingPeriod } from "../shared/utils/formatting.utils"; import { isNil, map } from "lodash"; export async function walkFolder(path: string): Promise> { @@ -262,14 +263,9 @@ export const extractComicArchive = (path: string) => async (dispatch) => { }, }); map(extractedComicBookArchive.data, (page) => { - const pathItems = page.filePath.split("/"); - const folderName = pathItems[pathItems.length - 2]; - const imagePath = encodeURI( - `${LIBRARY_SERVICE_HOST}/${page.containedIn}` + - `/` + - page.name + - page.extension, - ); + console.log(page); + const pageFilePath = removeLeadingPeriod(page); + const imagePath = encodeURI(`${LIBRARY_SERVICE_HOST}${pageFilePath}`); comicBookPages.push(imagePath); }); dispatch({