Skip to content

Commit 14156e1

Browse files
chore(internal): update isAbsoluteURL (#1223)
1 parent e18de1f commit 14156e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,8 @@ export const safeJSON = (text: string) => {
986986
}
987987
};
988988

989-
// https://stackoverflow.com/a/19709846
990-
const startsWithSchemeRegexp = new RegExp('^(?:[a-z]+:)?//', 'i');
989+
// https://url.spec.whatwg.org/#url-scheme-string
990+
const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
991991
const isAbsoluteURL = (url: string): boolean => {
992992
return startsWithSchemeRegexp.test(url);
993993
};

0 commit comments

Comments
 (0)