Skip to content

Commit e1b231d

Browse files
chore(internal): update isAbsoluteURL (#531)
1 parent 2b6cf7e commit e1b231d

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
@@ -951,8 +951,8 @@ export const safeJSON = (text: string) => {
951951
}
952952
};
953953

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

0 commit comments

Comments
 (0)