Use special scheme https when resolving URLs

Fixes #8
This commit is contained in:
John Factotum
2023-03-19 04:29:37 +00:00
committed by GitHub
parent 48d6972525
commit c510d83ea2
+1 -1
View File
@@ -59,7 +59,7 @@ const resolveURL = (url, relativeTo) => {
try { try {
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 = 'whatever:///' const root = 'https://invalid.invalid/'
return decodeURI(new URL(url, root + relativeTo).href.replace(root, '')) return decodeURI(new URL(url, root + relativeTo).href.replace(root, ''))
} catch(e) { } catch(e) {
console.warn(e) console.warn(e)