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

It already HTML-escapes characteres #73

Open
elias19r opened this issue Mar 30, 2022 · 1 comment
Open

It already HTML-escapes characteres #73

elias19r opened this issue Mar 30, 2022 · 1 comment

Comments

@elias19r
Copy link

elias19r commented Mar 30, 2022

Context

We are using the latest flutie gem in our Rails 6.1.5 app with the following code:

app/views/pages/show.html.erb

<% content_for :page_title, @page.title %>

app/views/layouts/application.html.erb

<title><%= page_title %></title>

Issue

For titles that contain characters that need to be HTML-escaped, we've noticed them being double-HTML-escaped.

For example, for the title Page & "Title" we get

<title>App : Page &amp;amp; &amp;quot;Title&amp;quot;</title>

which causes the browser to display it as

image

Instead, we expected to get

<title>App : Page &amp; &quot;Title&quot;</title>

which displays as expected

image

Workaround

We can replace <%= page_title %> with <%== page_title %> or <%= raw page_title %> to work around it.

@elias19r
Copy link
Author

Here is a spec that asserts it already HTML-escapes characters:
elias19r@2165815

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

1 participant