mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
EPUB: ignore query strings when resolving URLs
This commit is contained in:
@@ -64,7 +64,9 @@ const resolveURL = (url, relativeTo) => {
|
|||||||
if (relativeTo.includes(':')) return new URL(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
|
// the base needs to be a valid URL, so set a base URL and then remove it
|
||||||
const root = 'https://invalid.invalid/'
|
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) {
|
} catch(e) {
|
||||||
console.warn(e)
|
console.warn(e)
|
||||||
return url
|
return url
|
||||||
|
|||||||
Reference in New Issue
Block a user