mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-16 23:42:39 +01:00
Improve href-sanitizer
sciptlet
Tolerate unexpected spaces in extracted URL parameters. Related feedback: https://github.com/uBlockOrigin/uBlock-issues/issues/3297#issuecomment-2283806183
This commit is contained in:
parent
1822d1503f
commit
db3dc69bcc
@ -3551,9 +3551,12 @@ function hrefSanitizer(
|
||||
const end = recursive ? source.indexOf('?', 1) : source.length;
|
||||
try {
|
||||
const url = new URL(href, document.location);
|
||||
const value = url.searchParams.get(source.slice(1, end));
|
||||
let value = url.searchParams.get(source.slice(1, end));
|
||||
if ( value === null ) { return href }
|
||||
if ( recursive ) { return extractParam(value, source.slice(end)); }
|
||||
if ( value.includes(' ') ) {
|
||||
value = value.replace(/ /g, '%20');
|
||||
}
|
||||
return value;
|
||||
} catch(x) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user