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 processing of HTML attributes containing '/' character #83

Open
agr opened this issue Aug 27, 2017 · 0 comments
Open

Incorrect processing of HTML attributes containing '/' character #83

agr opened this issue Aug 27, 2017 · 0 comments

Comments

@agr
Copy link

agr commented Aug 27, 2017

When input markdown contains HTML tags with attributes that contain / character (URLs being the most obvious cause), library fails to parse it properly.

Example input:

<iframe width='400' height='300' src='https://github.com'></iframe>

The output:

<p>&lt;iframe width='400' height='300' src='https://github.com'&gt;</iframe></p>

Expected output: HTML should pass through more or less untouched:

<iframe width='400' height='300' src='https://github.com'></iframe>

The issue here is that HtmlTag.ParseHelper does not correctly handle the / character in the attribute values, considering it, I guess, the end of tag, and then deciding that HTML is malformed and treats it as any other text.

The fix that worked for me is to replace:

while (!p.eof && !char.IsWhiteSpace(p.current) && p.current != '>' && p.current != '/')

line with:

while (!p.eof && !char.IsWhiteSpace(p.current) && p.current != '>' && !p.DoesMatch("/>"))

But I am not sure it won't break something else.

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