Skip to content

Commit

Permalink
Merge pull request #1738 from csarven/fix/acl-checker/origin-non-iri-…
Browse files Browse the repository at this point in the history
…error-handling

Handle error when Origin header value is not IRI
  • Loading branch information
bourgeoa authored Oct 20, 2023
2 parents 958a6ef + e2c2d01 commit 72a3a69
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 72a3a69

Please sign in to comment.