Honor whitelist exclusion only for domain or subdomain match
authorIndrajit Raychaudhuri <redacted>
Thu, 22 Jun 2017 06:43:52 +0000 (01:43 -0500)
committerIndrajit Raychaudhuri <redacted>
Thu, 22 Jun 2017 06:43:56 +0000 (01:43 -0500)
* 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

index 59c9b6d617d64c55e557cbd30fc510f8f4661c29..27d5b09622363dd742c0259455107fc42dfd24a2 100644 (file)
@@ -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
 
git clone https://git.99rst.org/PROJECT