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

Rails HTML safe strings #140

Closed
samrjenkins opened this issue Aug 9, 2023 · 2 comments
Closed

Rails HTML safe strings #140

samrjenkins opened this issue Aug 9, 2023 · 2 comments

Comments

@samrjenkins
Copy link

Thank you so much for your work on this project.

I am getting in touch because the HTML/XML strings returned by the renderers present an issue when it comes to HTML safety.

Currently we solve this in our project by calling #html_safe on the strings returned by the renderers. However, calling #html_safe irks me slightly and I would prefer to avoid it.

Is there a possible solution you could implement in this gem? I would understand if you didn't wish to implement Rails-specific functionality though.

Would you have any other suggestions (possibly from how you use this gem in your own Rails projects) for elegantly handling HTML safety?

I have attempted to extract the SVG path data from the SVG string produced by as_svg and to then construct an HTML safe string using Rails tag helpers. This quickly became quite messy!

I would be interested to hear your thoughts.

@whomwah
Copy link
Owner

whomwah commented Aug 20, 2023

Hi Sam, Thanks for the question. I guess my initial answer would be if you are worried about the safety of the markup returned, could you not just use the 'as_png' renderer and not return any markup?

It's not something I'd plan to add to the lib I'm afraid. I guess if I were using the lib and it was something important to me, I'd probably create a 'safe_qrcode' helper function to call.

Dunc

@samrjenkins
Copy link
Author

Thanks for your thoughts

@samrjenkins samrjenkins closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2023
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

2 participants