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

Incorrect comment parsing #28

Closed
cole-miller opened this issue Apr 19, 2020 · 2 comments · Fixed by #29
Closed

Incorrect comment parsing #28

cole-miller opened this issue Apr 19, 2020 · 2 comments · Fixed by #29

Comments

@cole-miller
Copy link

Currently the following fragment

<!-- foo > -->

is incorrectly parsed as

Event::Comment, Event::Text("-->")

rather than the correct

Event::Comment

This happens because the following code allows Comments to end with a simple > instead of requiring -->:

svg/src/parser/mod.rs

Lines 72 to 82 in f945795

let content = self.reader.capture(|reader| reader.consume_until_char('>'));
if content.is_none() {
raise!(self, "found an empty tag");
}
if !self.reader.consume_char('>') {
raise!(self, "missing a closing angle bracket");
}
let content = content.unwrap();
Some(if content.starts_with("!--") {
Event::Comment
} else if content.starts_with('!') {

@IvanUkhov
Copy link
Member

Thanks for reporting! Do you have time to review #29?

@cole-miller
Copy link
Author

Sorry I didn't get the chance to look at the PR— thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants