From fd046bc46030912079ef1f5cf0dd97b3514e8dae Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Thu, 22 Jun 2017 01:43:52 -0500 Subject: [PATCH] Honor whitelist exclusion only for domain or subdomain match * Whitelisting `s.youtube.com` should not whitelist `ads.youtube.com`; but can whitelist `a.s.youtube.com` * Whitelisting `twitter.com` should not whitelist `ttwitter.com` or `twitter.com.au`; but can whitelist `a.twitter.com` --- updateHostsFile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updateHostsFile.py b/updateHostsFile.py index 59c9b6d61..27d5b0962 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -471,7 +471,7 @@ def remove_dups_and_excl(merge_file): # Normalize rule hostname, normalized_rule = normalize_rule(stripped_rule) for exclude in exclusions: - if exclude in line: + if re.search('[\s\.]' + re.escape(exclude) + '\s', line): write_line = False break