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

Upgrading from 5.1.2 to 5.2.2 #1078

Closed
choubacha opened this issue Jan 14, 2022 · 3 comments
Closed

Upgrading from 5.1.2 to 5.2.2 #1078

choubacha opened this issue Jan 14, 2022 · 3 comments

Comments

@choubacha
Copy link

And a string that used to parse correctly is now being over-encoded:

      %a{href: "[%= app.internalPath(h.path(\'profile\')) %]".html_safe, target: "_blank" }= s.t('header.link')

The result is that the apostrophe's around profile are encoded as:

h.path('profile')
@choubacha
Copy link
Author

It looks like this is intentional and only by completely turning off escaping attrs globally does it work again.

I'm not sure how the latest version caused this to start happening but would it be possible for attributes to allow html_safe strings?

@k0kubun
Copy link
Member

k0kubun commented Aug 18, 2022

We're being consistent with Rails in the way we approach the "vulnerability" with a CVE. Rails helpers escape attributes even if you pass an html_safe object, and we did the same #1028. If you want Haml's Rails support to be changed, I suggest you to let Rails change the behavior first.

@k0kubun k0kubun closed this as completed Aug 18, 2022
@mockdeep
Copy link

mockdeep commented Aug 30, 2022

This seems like a breaking change. We've got a bunch of handlebars style templates in our haml and upgrading causes quite a bit of breakage in our app:

- class_name = "requested-field {{= required ? 'required' : '' }}".html_safe
%div{ class: class_name }

the 'required' is becoming 'required'

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

3 participants