Closed laurenkt closed 5 months ago
Thank you for fixing this and including a test case! I'll publish a bugfix release after merging this. I haven't found a complete non-CGO implementation of xml canonicalization yet so we're doing the best we can. If you have issues in the future don't hesitate to reach out for help.
When there are runs of multiple comments like
<!-- comment0 --><!-- comment1 -->
then the second one is not stripped. This doesn't happen if there is whitespace between the comments.It seems like all comments should be stripped, but I checked just to be sure in case it's some weird quirk of the Canonical XML spec:
Here's a minimal project test case which reproduces the issue:
Output:
With a comment run like:
<!-- comment0 --><!-- comment1 --><!-- comment3 --><!-- comment4 -->
Then the output will be:<!-- comment1 --><!-- comment4 -->
So it seems like a comment immediately following another comment with no whitespace between them will reduce in comments being missed for stripping.