mirror of
https://github.com/StevenBlack/hosts.git
synced 2026-07-01 02:36:52 +00:00
Issue #1628: fix — parse out @ characters from lists.
This commit is contained in:
@@ -634,7 +634,7 @@ class TestMatchesExclusions(Base):
|
|||||||
self.assertTrue(matches_exclusions(domain, exclusion_regexes))
|
self.assertTrue(matches_exclusions(domain, exclusion_regexes))
|
||||||
|
|
||||||
def test_match_raw_list(self):
|
def test_match_raw_list(self):
|
||||||
exclusion_regexes = [r".*\.com", r".*\.org", r".*\.edu"]
|
exclusion_regexes = [r".*\.com", r".*\.org", r".*\.edu", r".*@.*"]
|
||||||
exclusion_regexes = [re.compile(regex) for regex in exclusion_regexes]
|
exclusion_regexes = [re.compile(regex) for regex in exclusion_regexes]
|
||||||
|
|
||||||
for domain in [
|
for domain in [
|
||||||
@@ -642,6 +642,7 @@ class TestMatchesExclusions(Base):
|
|||||||
"yahoo.com",
|
"yahoo.com",
|
||||||
"adaway.org",
|
"adaway.org",
|
||||||
"education.edu",
|
"education.edu",
|
||||||
|
"a.stro.lo.gy@45.144.225.135",
|
||||||
]:
|
]:
|
||||||
self.assertTrue(matches_exclusions(domain, exclusion_regexes))
|
self.assertTrue(matches_exclusions(domain, exclusion_regexes))
|
||||||
|
|
||||||
|
|||||||
@@ -943,6 +943,10 @@ def remove_dups_and_excl(merge_file, exclusion_regexes, output_file=None):
|
|||||||
if not stripped_rule or matches_exclusions(stripped_rule, exclusion_regexes):
|
if not stripped_rule or matches_exclusions(stripped_rule, exclusion_regexes):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Issue #1628
|
||||||
|
if ("@" in stripped_rule):
|
||||||
|
continue
|
||||||
|
|
||||||
# Normalize rule
|
# Normalize rule
|
||||||
hostname, normalized_rule = normalize_rule(
|
hostname, normalized_rule = normalize_rule(
|
||||||
stripped_rule,
|
stripped_rule,
|
||||||
|
|||||||
Reference in New Issue
Block a user