From 9ce274dcf8b2c3406036fae042a163cdd5c68a87 Mon Sep 17 00:00:00 2001 From: yami Date: Mon, 31 Jul 2023 05:58:50 +0530 Subject: [PATCH] fixed: epub openInNewWindow error --- src/App.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 277cb5b..fa4794e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -408,13 +408,16 @@ const App = (): ReactElement => { }; const openInNewWindow = (link: string) => { - checkValidFolder( - link, - (isValid) => { - if (isValid) window.electron.ipcRenderer.send("openLinkInNewWindow", link); - }, - false - ); + if (link.toLowerCase().includes(".epub") && window.fs.existsSync(link)) + window.electron.ipcRenderer.send("openLinkInNewWindow", link); + else + checkValidFolder( + link, + (isValid) => { + if (isValid) window.electron.ipcRenderer.send("openLinkInNewWindow", link); + }, + false + ); }; useLayoutEffect(() => {