Skip to content

Commit

Permalink
fix: include whitespace as well
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Feb 18, 2023
1 parent 4d21179 commit d105b1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function isRelative(inputString: string) {

const PROTOCOL_STRICT_REGEX = /^\w{2,}:([/\\]{1,2})/;
const PROTOCOL_REGEX = /^\w{2,}:([/\\]{2})?/;
const PROTOCOL_RELATIVE_REGEX = /^[/\\]{2,}[^/\\]/;
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;

export interface HasProtocolOptions {
acceptRelative?: boolean;
Expand Down
1 change: 1 addition & 0 deletions test/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe("hasProtocol", () => {
// Relative
{ input: "//test.com", out: [false, false, true] },
{ input: "///test.com", out: [false, false, true] },
{ input: "/\t//test.com", out: [false, false, true] },
{ input: "/\\/test.com", out: [false, false, true] },
{ input: "/\\localhost//", out: [false, false, true] },
];
Expand Down

0 comments on commit d105b1c

Please sign in to comment.