Issue #2863: fix — exclude domains with underscores in the domain name.
authorSteven Black <redacted>
Sat, 12 Apr 2025 15:52:28 +0000 (11:52 -0400)
committerSteven Black <redacted>
Sat, 12 Apr 2025 15:52:28 +0000 (11:52 -0400)
testUpdateHostsFile.py
updateHostsFile.py

index 3dfa76f43382461281ae9201f1ab6119b4e3d27f..764402768bee041eb6f74aa8a425576173ca7e61 100644 (file)
@@ -847,6 +847,7 @@ class TestNormalizeRule(BaseStdout):
             "0.0.0.0 https",
             "0.0.0.0 https..",
             "0.0.0.0 foo.",
+            "0.0.0.0 this_that.com",
         ]:
             self.assertEqual(normalize_rule(rule, **kwargs), (None, None))
 
index 059cb731c190534d7b1d78cd463b4f67825ef9fc..d57f366214b1949884ccf41a327148eb80e0ac80 100755 (executable)
@@ -1133,6 +1133,7 @@ def normalize_rule(rule, target_ip, keep_domain_comments):
             or "." in hostname[-1]
             or "/" in hostname
             or ":" in hostname
+            or "_" in hostname
         ):
             # Example: 0.0.0.0 127.0.0.1
 
@@ -1143,6 +1144,7 @@ def normalize_rule(rule, target_ip, keep_domain_comments):
             #   - ends in a dot, or
             #   - contains a slash, or
             #   - contains a colon,
+            #   - contains an underscore,
             # we don't want to normalize it.
             return belch_unwanted(rule)
 
git clone https://git.99rst.org/PROJECT