Skip to content

Commit 99289f5

Browse files
chore(internal): update isAbsoluteURL (#531)
1 parent 2ecd5ad commit 99289f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ export const safeJSON = (text: string) => {
970970
}
971971
};
972972

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

0 commit comments

Comments
 (0)