From 72fdce64f0cd9ee763032e9bb340658086ffd987 Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 27 Jun 2016 14:11:36 -0400 Subject: [PATCH] fix issue reported in comment https://github.com/gorhill/uBlock/issues/1669#issuecomment-224822448 --- src/js/static-net-filtering.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index d0fe061e8..d9262b711 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -1566,7 +1566,11 @@ FilterParser.prototype.parse = function(raw) { // normalize placeholders if ( this.reHasWildcard.test(s) ) { // remove pointless leading * - if ( s.startsWith('*') ) { + // https://github.com/gorhill/uBlock/issues/1669#issuecomment-224822448 + // Keep the leading asterisk if we are dealing with a hostname-anchored + // filter, this will ensure the generic filter implementation is + // used. + if ( s.startsWith('*') && this.hostnameAnchored === false ) { s = s.replace(/^\*+([^%0-9a-z])/, '$1'); } // remove pointless trailing *