Skip to content

Commit

Permalink
Remove in line comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Trellmor committed Aug 23, 2022
1 parent 290ebfd commit 26a2f34
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion update-zonefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

regex_domain = '^(127|0)\\.0\\.0\\.(0|1)[\\s\\t]+(?P<domain>([a-z0-9\\-_]+\\.)+[a-z][a-z0-9_-]*)$'
regex_no_comment = '^#.*|^$'
regex_no_comment_in_line = '^([^#]+)'

def download_list(url):
headers = None
Expand Down Expand Up @@ -136,8 +137,14 @@ def parse_lists(origin):
for line in data.splitlines():
domain = ''

m = re.match(regex_no_comment, line)
if re.match(regex_no_comment, line):
continue

m = re.search(regex_no_comment_in_line, line)
if m:
line = m.group(1).strip()

if line == '':
continue

if l.get('format', 'domain') == 'hosts':
Expand Down

0 comments on commit 26a2f34

Please sign in to comment.