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

Fix issue where adjacent comments were skipped during canonicalization #51

Merged

Conversation

laurenkt
Copy link
Contributor

Addresses issue #50

If comments were adjacent in a document with no whitespace between them, then for each pair of comments the second comment would be skipped due to the underlying slice being modified as it was being ranged over.

For example, the following document:

<a><!-- comment1 --><!-- comment2 --><!-- comment 3 --></a>

Would be incorrectly canonicalized to:

<a><!-- comment2 --></a>

This patch fixes that issue and adds a new test case to cover it.

Addresses issue moov-io#50

If comments were adjacent in a document with no whitespace between them, then for each pair of comments the second comment would be skipped due to the underlying slice being modified as it was being ranged over.

For example, the following document:

```xml
<a><!-- comment1 --><!-- comment2 --><!-- comment 3 --></a>
```

Would be incorrectly canonicalized to:

```xml
<a><!-- comment2 --></a>
```

This patch fixes that issue and adds a new test case to cover it.
Copy link
Member

@adamdecaf adamdecaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@adamdecaf adamdecaf merged commit eff650e into moov-io:master Mar 20, 2024
3 checks passed
@laurenkt laurenkt deleted the issue-50/adjacent-comments-not-removed branch March 26, 2024 13:21
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.

2 participants