From d49a9dce66de6c3af1c31b9384293cddd96eb574 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 13 Jul 2020 09:33:38 -0400 Subject: [PATCH] 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. --- src/js/redirect-engine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index 9e0f30446..3440e037c 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -460,7 +460,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) { let type, redirect = '', srchns = []; - for ( const option of matches[3].split(',') ) { + for ( const option of matches[3].trim().split(/,/) ) { if ( option.startsWith('redirect=') ) { redirect = option.slice(9); continue;