Skip to content

Commit ac05880

Browse files
committedDec 21, 2018
fix(isUrlRequest): ignore about:blank
1 parent 47e2e02 commit ac05880

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎lib/isUrlRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function isUrlRequest(url, root) {
55
// 1. it's a Data Url
66
// 2. it's an absolute url or and protocol-relative
77
// 3. it's some kind of url for a template
8-
if(/^data:|^.+-extension:\/|^(https?:)?\/\/|^[\{\}\[\]#*;,'§\$%&\(=?`´\^°<>]/.test(url)) {
8+
if(/^data:|^.+-extension:\/|^about:blank$|^(https?:)?\/\/|^[\{\}\[\]#*;,'§\$%&\(=?`´\^°<>]/.test(url)) {
99
return false;
1010
}
1111

‎test/isUrlRequest.test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ describe("isUrlRequest()", () => {
5151
[["/path/to/thing", 1], new ExpectedError(/unexpected parameters/i), "should throw an error on invalid root"],
5252

5353
// empty url
54-
[[""], true, "should be positive if url is empty"]
54+
[[""], true, "should be positive if url is empty"],
55+
56+
// about url
57+
[["about:blank"], false, "should be negative for about:blank"]
5558
].forEach((test) => {
5659
it(test[2], () => {
5760
const expected = test[1];

0 commit comments

Comments
 (0)
Please sign in to comment.