Skip to content

Commit

Permalink
Handle error when Origin header value is not IRI
Browse files Browse the repository at this point in the history
  • Loading branch information
csarven committed Sep 4, 2023
1 parent bbb8d78 commit f85a4bc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/acl-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ class ACLChecker {
constructor (resource, options = {}) {
this.resource = resource
this.resourceUrl = new URL(resource)
this.agentOrigin = options.strictOrigin && options.agentOrigin ? rdf.sym(options.agentOrigin) : null
this.agentOrigin = null
try {
if (options.strictOrigin && options.agentOrigin) {
this.agentOrigin = rdf.sym(options.agentOrigin)
}
} catch (e) {
// noop
}
this.fetch = options.fetch
this.fetchGraph = options.fetchGraph
this.trustedOrigins = options.strictOrigin && options.trustedOrigins ? options.trustedOrigins.map(trustedOrigin => rdf.sym(trustedOrigin)) : null
Expand Down

0 comments on commit f85a4bc

Please sign in to comment.