From 21f7f0a933b4189d7e044b08b50e5a240c812490 Mon Sep 17 00:00:00 2001 From: Steven Black Date: Sat, 12 Apr 2025 11:52:28 -0400 Subject: [PATCH] =?UTF-8?q?Issue=20#2863:=20fix=20=E2=80=94=20exclude=20do?= =?UTF-8?q?mains=20with=20underscores=20in=20the=20domain=20name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- testUpdateHostsFile.py | 1 + updateHostsFile.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/testUpdateHostsFile.py b/testUpdateHostsFile.py index 3dfa76f43..764402768 100644 --- a/testUpdateHostsFile.py +++ b/testUpdateHostsFile.py @@ -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)) diff --git a/updateHostsFile.py b/updateHostsFile.py index 059cb731c..d57f36621 100755 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -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)