From d44e8d6d6414610099b09a57790852f68866aa49 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Wed, 11 Oct 2023 01:38:01 +0800 Subject: [PATCH] EPUB: ignore query strings when resolving URLs --- epub.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epub.js b/epub.js index ea69849..96a0b6e 100644 --- a/epub.js +++ b/epub.js @@ -64,7 +64,9 @@ const resolveURL = (url, relativeTo) => { if (relativeTo.includes(':')) return new URL(url, relativeTo) // the base needs to be a valid URL, so set a base URL and then remove it const root = 'https://invalid.invalid/' - return decodeURI(new URL(url, root + relativeTo).href.replace(root, '')) + const obj = new URL(url, root + relativeTo) + obj.search = '' + return decodeURI(obj.href.replace(root, '')) } catch(e) { console.warn(e) return url