Fix spurious rejection of some AdGuard redirect filters

Lines in AdGuard filter lists have trailing `\r`
characters, and these caused the redirect engine
compile code to reject as invalid the redirect
token.

This is trivially fixed by trimming the raw option
strings before parsing it in the redirect engine.
This commit is contained in:
Raymond Hill 2020-07-13 09:33:38 -04:00
parent ba0d4f8a38
commit d49a9dce66
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 1 additions and 1 deletions

View File

@ -460,7 +460,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
let type, let type,
redirect = '', redirect = '',
srchns = []; srchns = [];
for ( const option of matches[3].split(',') ) { for ( const option of matches[3].trim().split(/,/) ) {
if ( option.startsWith('redirect=') ) { if ( option.startsWith('redirect=') ) {
redirect = option.slice(9); redirect = option.slice(9);
continue; continue;