Skip to content

It already HTML-escapes characteres #73

@elias19r

Description

@elias19r

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions