Skip to content

Commit

Permalink
fix: Ignore any protocols that aren't http or https (#507)
Browse files Browse the repository at this point in the history
The API will throw an error anyways, so we shouldn't bother trying to create
resources or snapshots with non `http` or `https` protocols.
  • Loading branch information
Robdel12 committed May 14, 2020
1 parent 5a971b3 commit 8a121b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/services/asset-discovery-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ export class AssetDiscoveryService extends PercyClientService {
const parsedRootResourceUrl = new URL(rootResourceUrl)
const rootUrl = `${parsedRootResourceUrl.protocol}//${parsedRootResourceUrl.host}`

// Only capture resources with a proper protocol we support capturing
if ((/^https?:/).test(resourceUrl)) {
return true
}

// Process if the resourceUrl has a hostname in the allowedHostnames
if (this.configuration['allowed-hostnames'].some((hostname) => domainMatch(hostname, resourceUrl))) {
return true
Expand Down

0 comments on commit 8a121b6

Please sign in to comment.