From f6c46ab5826a2a4ff6d06943a50887fbfe81caa2 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 26 Oct 2016 08:59:15 -0400 Subject: [PATCH] fix #2099 --- src/js/redirect-engine.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index 89e79600a..473bffa79 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -232,15 +232,15 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) { if ( matches === null || matches.length !== 4 ) { return; } - - var des = matches[1] || ''; - var pattern = (des + matches[2]).replace(/[.+?{}()|[\]\/\\]/g, '\\$&') + var µburi = µBlock.URI, + des = matches[1] || '', + pattern = (des + matches[2]).replace(/[.+?{}()|[\]\/\\]/g, '\\$&') .replace(/\^/g, '[^\\w\\d%-]') - .replace(/\*/g, '.*?'); - var type; - var redirect = ''; - var srcs = []; - var options = matches[3].split(','), option; + .replace(/\*/g, '.*?'), + type, + redirect = '', + srcs = [], + options = matches[3].split(','), option; while ( (option = options.pop()) ) { if ( option.startsWith('redirect=') ) { redirect = option.slice(9); @@ -251,7 +251,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) { continue; } if ( option === 'first-party' ) { - srcs.push(des); + srcs.push(µburi.domainFromHostname(des) || des); continue; } // One and only one type must be specified.