opal / opal-haml

Opal + Haml = <3
MIT License
23 stars 5 forks source link

Passing url in JSON crashing rendering #11

Closed michalg- closed 2 years ago

michalg- commented 2 years ago

Hello, I have a problem with rendering img tag. I have a quite simple view

.rounded.overflow-hidden.border-2.border-grey-200.border-opacity-100
  %img.w-full{src: "#{self['image_url']}", alt: "Sunset in the mountains"}
  .px-6.py-4

and when i’m passing an object:

$document.at('#main-container').inner_html = Template['views/quiz/form'].render(res.json)

res:

{"id": "95b4406d-2bca-4d86-94f4-12078d11eca4", "image_url": "http://localhost:3000/derivations/crop/1600/1000/eyJpZCI6InF1aXovOTViNDQwNmQtMmJjYS00ZDg2LTk0ZjQtMTIwNzhkMTFlY2E0L2ltYWdlLzFkY2RlYTZhNDMwNGI0NzkwYThmZjI5MWQwYzY5NmQxLmpwZWciLCJzdG9yYWdlIjoic3RvcmUifQ?signature=1dd23cba5070cf334507f9eafc55b4e97c4539be9c502d05040f4678c9192e47" }

It throws

undefined method `html_escape_without_haml_xss' for Haml::Helpers

in the browser console. When I’m setting any string as url, not value from self it works. There is any way to bypass that?