Skip to content

Commit 66e3a1a

Browse files
committed
Improve href-sanitizer scriptlet
Related issue: uBlockOrigin/uBlock-issues#3297 Mind that the sanitized URL can have Unicode characters beyond ASCII.
1 parent 569c8cb commit 66e3a1a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

assets/resources/scriptlets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,7 @@ function hrefSanitizer(
34773477
};
34783478
const validateURL = text => {
34793479
if ( text === '' ) { return ''; }
3480-
if ( /[^\x21-\x7e]/.test(text) ) { return ''; }
3480+
if ( /[\x00-\x20\x7f]/.test(text) ) { return ''; }
34813481
try {
34823482
const url = new URL(text, document.location);
34833483
return url.href;

0 commit comments

Comments
 (0)