mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Improve href-sanitizer scriptlet
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3297 Mind that the sanitized URL can have Unicode characters beyond ASCII.
This commit is contained in:
parent
569c8cbe04
commit
66e3a1ad47
1 changed files with 1 additions and 1 deletions
|
|
@ -3477,7 +3477,7 @@ function hrefSanitizer(
|
|||
};
|
||||
const validateURL = text => {
|
||||
if ( text === '' ) { return ''; }
|
||||
if ( /[^\x21-\x7e]/.test(text) ) { return ''; }
|
||||
if ( /[\x00-\x20\x7f]/.test(text) ) { return ''; }
|
||||
try {
|
||||
const url = new URL(text, document.location);
|
||||
return url.href;
|
||||
|
|
|
|||
Loading…
Reference in a new issue