Skip to content

Commit

Permalink
fix(isUrlRequest): ignore about:blank
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 21, 2018
1 parent 47e2e02 commit ac05880
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/isUrlRequest.js
Expand Up @@ -5,7 +5,7 @@ function isUrlRequest(url, root) {
// 1. it's a Data Url
// 2. it's an absolute url or and protocol-relative
// 3. it's some kind of url for a template
if(/^data:|^.+-extension:\/|^(https?:)?\/\/|^[\{\}\[\]#*;,'§\$%&\(=?`´\^°<>]/.test(url)) {
if(/^data:|^.+-extension:\/|^about:blank$|^(https?:)?\/\/|^[\{\}\[\]#*;,'§\$%&\(=?`´\^°<>]/.test(url)) {
return false;
}

Expand Down
5 changes: 4 additions & 1 deletion test/isUrlRequest.test.js
Expand Up @@ -51,7 +51,10 @@ describe("isUrlRequest()", () => {
[["/path/to/thing", 1], new ExpectedError(/unexpected parameters/i), "should throw an error on invalid root"],

// empty url
[[""], true, "should be positive if url is empty"]
[[""], true, "should be positive if url is empty"],

// about url
[["about:blank"], false, "should be negative for about:blank"]
].forEach((test) => {
it(test[2], () => {
const expected = test[1];
Expand Down

0 comments on commit ac05880

Please sign in to comment.