From d9dc18da433af90e249669eece2ed796e07d91e5 Mon Sep 17 00:00:00 2001 From: Rider21 <58046032+Rider21@users.noreply.github.com> Date: Wed, 21 Aug 2024 17:25:39 +0300 Subject: [PATCH] fix: download files with relative url (#1216) * hard fix * test * Revert "test" This reverts commit 1fe9247752fcbadf348b6017f2d1fbf05165cfce. * error handler [URL](https://github.com/facebook/react-native/blob/v0.72.10/packages/react-native/Libraries/Blob/URL.js) --- src/services/download/downloadChapter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/download/downloadChapter.ts b/src/services/download/downloadChapter.ts index 148e8a9f3..8d68c75fc 100644 --- a/src/services/download/downloadChapter.ts +++ b/src/services/download/downloadChapter.ts @@ -49,7 +49,8 @@ const downloadFiles = async ( const fileurl = `${folder}/${i}.b64.png`; elem.attr('src', `file://${fileurl}`); try { - await downloadFile(url, fileurl, plugin.imageRequestInit); + const absoluteURL = new URL(url, plugin.site).href; + await downloadFile(absoluteURL, fileurl, plugin.imageRequestInit); } catch (e) { elem.attr('alt', String(e)); }