Skip to content

Commit

Permalink
fix: download files with relative url (#1216)
Browse files Browse the repository at this point in the history
* hard fix

* test

* Revert "test"

This reverts commit 1fe9247.

* error handler

[URL](https://github.com/facebook/react-native/blob/v0.72.10/packages/react-native/Libraries/Blob/URL.js)
  • Loading branch information
Rider21 committed Aug 21, 2024
1 parent a22d754 commit d9dc18d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/services/download/downloadChapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit d9dc18d

Please sign in to comment.