From d7d977569bae807480121434bffd6e04eb24725f Mon Sep 17 00:00:00 2001 From: reger24 <11603289+reger24@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:22:08 +0100 Subject: [PATCH] Optimize IndexBroser_p - "Add to blacklist" button to better match hosts with www. using the default match substitution (to match www.host.com/ and host.com/) --- htroot/IndexBrowser_p.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htroot/IndexBrowser_p.java b/htroot/IndexBrowser_p.java index 48dbea414..58f9be452 100644 --- a/htroot/IndexBrowser_p.java +++ b/htroot/IndexBrowser_p.java @@ -662,9 +662,13 @@ public class IndexBrowser_p { final File blacklistsPath = sb.getDataPath(SwitchboardConstants.LISTS_PATH, SwitchboardConstants.LISTS_PATH_DEFAULT); String blacklistname = Blacklist.defaultBlacklist(blacklistsPath); if (blacklistname != null) { + String hoststr = pathURI.getHost(); + if (hoststr.startsWith("www.")) { // to allow the automatic matching for www.host.com and host.com + hoststr = hoststr.substring(4); + } addBlacklistEntry( blacklistname, - "*." + pathURI.getHost()); + hoststr + "/.*"); // as yacy expands host pattern to match www.host.com as well as host.com no need to prefix with "*." } } }