Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: No escaped character #49

Open
henryford-metoffice opened this issue Oct 25, 2024 · 0 comments
Open

ValueError: No escaped character #49

henryford-metoffice opened this issue Oct 25, 2024 · 0 comments

Comments

@henryford-metoffice
Copy link

When parsing a zone file with DMARC records which have a trailing escaped semi-colon, the library throws an error:

Two relevant lines from our zone file:
(redacted)._dmarc 3600 IN TXT v=DMARC1
(redacted)._dmarc 3600 IN TXT v=DMARC1\;

The line without "\;" parses just fine, but the line with "\;" causes:
Traceback (most recent call last):
File "C:\git\webteam-site-shield\akamai\get_zones.py", line 88, in
main()
File "C:\git\webteam-site-shield\akamai\get_zones.py", line 28, in main
records = get_master_zone_file("metoffice.gov.uk")
File "C:\git\webteam-site-shield\akamai\get_zones.py", line 57, in get_master_zone_file
records = zonefile_parser.parse(content_as_string)
File "C:\git\webteam-site-shield\akamai\venv\lib\site-packages\zonefile_parser\main.py", line 188, in parse
normalized_records = list(
File "C:\Program Files\Python310\lib\shlex.py", line 315, in split
return list(lex)
File "C:\Program Files\Python310\lib\shlex.py", line 300, in next
token = self.get_token()
File "C:\Program Files\Python310\lib\shlex.py", line 109, in get_token
raw = self.read_token()
File "C:\Program Files\Python310\lib\shlex.py", line 210, in read_token
raise ValueError("No escaped character")
ValueError: No escaped character

  1. Is the zone file not meeting the standard?
  2. Either way, can the library support escaped semicolons without throwing an error?
  3. If it has to throw an error, can the error thrown be more useful?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant