philss / floki

Floki is a simple HTML parser that enables search for nodes using CSS selectors.
https://hex.pm/packages/floki
MIT License
2.05k stars 155 forks source link

Floki.raw_html/2 doesn't correctly encode attributes with both single and double quotes #209

Closed ericlathrop closed 4 years ago

ericlathrop commented 5 years ago

Example:

iex(21)> "<span data-stuff=\"&quot;&#39;\">" |> Floki.parse |> Floki.raw_html  
"<span data-stuff='\"''></span>"

Expected either:

"<span data-stuff='\"&#39;'></span>"

or

"<span data-stuff=\"&quot;'\"></span>"
philss commented 4 years ago

@ericlathrop sorry for the delay. Thank you for open it. I believe this can be fixed almost in the same way that was in Meeseeks.

danhuynhdev commented 4 years ago

Hi @philss, I've created a PR (#227) for this. Hope to get some feedback from you.

philss commented 4 years ago

@danhuynhdev Thank you! :purple_heart:

I'm going to take a look this week, I hope. It looks like it fixes the problem, but I want to check some scenarios.