Skip to content

Commit e908ed7

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): update isAbsoluteURL (#1223)
1 parent 576d24c commit e908ed7

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
@@ -1013,8 +1013,8 @@ export const safeJSON = (text: string) => {
10131013
}
10141014
};
10151015

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

0 commit comments

Comments
 (0)