From b7a2352c6f9ea8e23210ad3bf9c7ec0626d73fc3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 22 Feb 2021 07:57:23 -0500 Subject: [PATCH] Do not suggest network filters with wildcarded hostname in picker Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1494 --- src/js/scriptlets/epicker.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/scriptlets/epicker.js b/src/js/scriptlets/epicker.js index 4f84121a1..f6cd150e1 100644 --- a/src/js/scriptlets/epicker.js +++ b/src/js/scriptlets/epicker.js @@ -176,7 +176,11 @@ const mergeStrings = function(urls) { merged = merged.replace(/^\*+$/, '') .replace(/\*{2,}/g, '*') .replace(/([^*]{1,3}\*)(?:[^*]{1,3}\*)+/g, '$1'); - return merged; + + // https://github.com/uBlockOrigin/uBlock-issues/issues/1494 + let pos = merged.indexOf('/'); + if ( pos === -1 ) { pos = merged.length; } + return merged.slice(0, pos).includes('*') ? urls[0] : merged; }; /******************************************************************************/