diff --git a/.changeset/twelve-seahorses-tap.md b/.changeset/twelve-seahorses-tap.md new file mode 100644 index 0000000..6d24534 --- /dev/null +++ b/.changeset/twelve-seahorses-tap.md @@ -0,0 +1,5 @@ +--- +"rdf-transform-graph-imports": patch +--- + +Fix error when resolving HTTPS imports diff --git a/lib/path.ts b/lib/path.ts index 7196b70..4d0d0b2 100644 --- a/lib/path.ts +++ b/lib/path.ts @@ -6,6 +6,8 @@ interface Options { extension?: string } +const PROTOCOL_PATTERN = /^https?:/i + export function resolveImport(importNode: Term, { extension }: Options = {}) { if (importNode.termType !== 'NamedNode') { throw new Error(`Import target must be a NamedNode. Got ${importNode.termType}`) @@ -13,7 +15,7 @@ export function resolveImport(importNode: Term, { extension }: Options = {}) { try { const targetUri = new URL(importNode.value) - if (targetUri.protocol === 'http:') { + if (PROTOCOL_PATTERN.test(targetUri.protocol)) { return targetUri }