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

Fix bug propagating identity encoder in raw_html/2 #603

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

andyleclair
Copy link
Contributor

Hi! We noticed a bug when going to upgrade Floki. It seems that any tag that is set to the identity encoder would propagate that encoder through the rest of the tree (instead of just to its' children). I've added a test case here taken from some real Appcues content that triggers this behavior. Without this fix, it's very possible for Floki to emit broken HTML. If you parse any script or style, tag, the identity encoder would be applied, which would in this case, emit an un-escaped data-attrs-event tag (even if escaping is explicitly enabled!). I'm dubious on if it's the duty to handle not decoding the entities in the parser, but I'm 100% sure this is a bug as-is.

lib/floki/raw_html.ex Outdated Show resolved Hide resolved
@philss philss merged commit 4700038 into philss:main Dec 6, 2024
6 checks passed
@philss
Copy link
Owner

philss commented Dec 6, 2024

@andyleclair good call! Thank you!

@andyleclair
Copy link
Contributor Author

Thank you @philss! I'd love it if you didn't mind cutting a release with this fix in it.

@philss
Copy link
Owner

philss commented Dec 6, 2024

@andyleclair sure! I did a minor version release: v0.37.0. LMK if this works for you.

@andyleclair
Copy link
Contributor Author

@philss perfect, thank you so much!

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

Successfully merging this pull request may close these issues.

3 participants