From 34504a0a1a9db37d4bb8c6a3ca2ae05942750f12 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 4 Dec 2019 10:42:03 -0500 Subject: [PATCH] Fix regex-like filter representation in logger Related discussion: - https://github.com/uBlockOrigin/uBlock-issues/issues/805#issuecomment-561500819 uBO was testing for regex-like plain patterns after prepending `@@` in the case of exception filters, thus preventing proper detection of regex-like plain patterns. The filtering engine was not affected, only the proper rendering of the filter in the logger was affected. --- src/js/static-net-filtering.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 8fea9b06a..0f792cc40 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -223,9 +223,6 @@ const toLogDataInternal = function(categoryBits, tokenHash, iunit) { const domains = []; const logData = { pattern, regex, domains, options, isRegex: false }; filterUnits[iunit].logData(logData); - if ( categoryBits & 0x001 ) { - logData.pattern.unshift('@@'); - } if ( categoryBits & 0x002 ) { logData.options.unshift('important'); } @@ -246,6 +243,9 @@ const toLogDataInternal = function(categoryBits, tokenHash, iunit) { ) { raw += '*'; } + if ( categoryBits & 0x001 ) { + raw = '@@' + raw; + } if ( domains.length !== 0 ) { options.push(`domain=${domains.join('|')}`); }