floki icon indicating copy to clipboard operation
floki copied to clipboard

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

Open ericlathrop opened this issue 7 years ago • 3 comments

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>"

ericlathrop avatar Jul 23 '19 17:07 ericlathrop

@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.

philss avatar Oct 05 '19 18:10 philss

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

tantmd avatar Oct 06 '19 12:10 tantmd

@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.

philss avatar Oct 07 '19 03:10 philss