Auto-Commit: 2026-08-27 07:26:16
This commit is contained in:
1 parent
ed5cc23a35
commit
0a3b333f84
1753 files changed
+318589
No files matched your search
+24
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const urlParserControlCharacters = /[\t\n\r]/g;
|
||||
|
||||
/**
|
||||
* Match WHATWG URL preprocessing before checking a URL's protocol.
|
||||
*
|
||||
* @param {string} url
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
export default function normalizeURLForProtocolCheck(url) {
|
||||
if (typeof url !== 'string') {
|
||||
return url;
|
||||
}
|
||||
|
||||
let start = 0;
|
||||
|
||||
while (start < url.length && url.charCodeAt(start) <= 0x20) {
|
||||
start++;
|
||||
}
|
||||
|
||||
return url.slice(start).replace(urlParserControlCharacters, '');
|
||||
}
|
||||
Reference in new issue
Block a user