Skip to content

Comments

Wrong parsing result for TXT records containing semicolons#34

Open
sergiomonteleone wants to merge 56 commits intoelgs:masterfrom
stacks-network:master
Open

Wrong parsing result for TXT records containing semicolons#34
sergiomonteleone wants to merge 56 commits intoelgs:masterfrom
stacks-network:master

Conversation

@sergiomonteleone
Copy link

The function removeComments() in parseZoneFile.js will remove any string starting with semicolon (;). Unfortunately this causes issues with TXT records with semicolon characters in it, breaking parsing.
Replacing the regular expression in removeConnets() to something like this: /^;.*/gm solves the problem.

@elgs
Copy link
Owner

elgs commented Jul 17, 2019

Thank you so much for the PR and reminding me about the bug. I really appreciate. But the changes in this PR are too big for me to comprehend. I will try to fix the bug itself. Thank you!

@sergiomonteleone
Copy link
Author

Hi and thanks for your quick reply.
I'm sorry, I selected the wrong branch while submitting the PR and created this huge PR mess... my bad.

I just wanted to propose a simple modification, which changes the regular expression used in the function removeComments()

Here is a link to the patch I used in my working copy: https://gist.github.com/sergiomonteleone/a3fc44c2c6f8ca6b54f057ac3b3fa72e

Note: while this will prevent the parser from removing characters from the TXT records, it may fail to remove inline comments, as this regex will only select lines starting with semicolon. TLDR it may need more testing.

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

Successfully merging this pull request may close these issues.

8 participants