Skip to content

a javascript error is reported on all overrided pages containing javascript with charaters (>,&,<)#229

Open
mathieu-mbru wants to merge 4 commits into
spree:masterfrom
mathieu-mbru:issue_apply_overrides
Open

a javascript error is reported on all overrided pages containing javascript with charaters (>,&,<)#229
mathieu-mbru wants to merge 4 commits into
spree:masterfrom
mathieu-mbru:issue_apply_overrides

Conversation

@mathieu-mbru

Copy link
Copy Markdown

Replace source = doc.to_s by source = doc.to_s.gsub('&lt;', '<').gsub('&gt;', '>').gsub('&amp;', '&')
for transforming the encodings

…('&gt;', '>').gsub('&amp;', '&') for transforming the encodings
@nanego

nanego commented Mar 17, 2022

Copy link
Copy Markdown

A more generic solution may be this one. Can you please give it a try?

-        source = doc.to_s
+        source = CGI.unescapeHTML doc.to_s

@mathieu-mbru

Copy link
Copy Markdown
Author

Well, thank you for this solution.

@HighwayStar

Copy link
Copy Markdown

Any updates on this pull? Faced this issue, spent hours to find root of issue with js code after applying deface patches on redmine.

@froger

froger commented Apr 17, 2025

Copy link
Copy Markdown

Hi, I can reproduce the bug in a different situation that makes me suffer this last two years, and the PR fixes it!

given that files:

  • /app/views/proposals/index.html.erb
  • /app/views/proposals/index.js.erb

Then if I do an override on proposals/index, the .js.erb ends up with html-encoded chars.

Deface is heavily used by Decidim ecosystem to do modules, so we do know this bug have been there for a while. I would really appreciate if we could merge the PR, this will enable to have much more straight forward use of the gem.

Edit: using deface 1.9.0

@damianlegawiec

Copy link
Copy Markdown
Member

Hey @froger

Happy to move this repo outside of Spree org to a dedicated one and hand over maintenance. We don't use Deface at Spree anymore, hence our reduced engagement here

@alexandermeindl

Copy link
Copy Markdown

Hey @damianlegawiec,
can you tell me, what is your replacement for Deface at Spree?

@froger

froger commented Apr 17, 2025

Copy link
Copy Markdown

Thanks @damianlegawiec, need some time to answer that one. It might be a good solution for us, but need to gather feedbacks first.

@froger

froger commented Apr 28, 2025

Copy link
Copy Markdown

Hi @damianlegawiec,
Thanks for waiting. So you can transfert the gem to the organization https://github.com/decidim-ice the Decidim International Community Environment.
My company Octree will invest some time yearly to maintain the gem, and we hope other contributors from the ecosystem will chime in to improve and dinamise the gem.

I will contact you in MP to know more about how we can make the switch effective in rubygem too.
Thanks a lot !

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.

6 participants