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

ActionMailer doing escaping in text templates #2496

Closed
gucki opened this issue Aug 11, 2011 · 5 comments
Closed

ActionMailer doing escaping in text templates #2496

gucki opened this issue Aug 11, 2011 · 5 comments

Comments

@gucki
Copy link

gucki commented Aug 11, 2011

Using rails 3.1.0.rc5.

Create an email template/ view test.text.erb like this:

Your id is >><%=id%><<.

The layout.text.erb contains this:

<%==yield%>
>>Test<<

The plain text body of the email then shows:

Your id is &gt;&gt;454&lt;&lt;.
>>Test<<

There should be no escaping at all in text views.

@gucki
Copy link
Author

gucki commented Aug 11, 2011

My current workaround is using the following in my mailer layout.text.erb:

<%==HTMLEntities.new.decode(String.new(yield))%>

@bensomers
Copy link

I am encountering a similar error, quite possibly the same one. In my case, I'm rendering a .xml.builder template as a partial. It works properly if I render it with no layout, or if I don't render it as a partial; it works properly if I override ActionView::Helpers::CaptureHelper and remove the ERB::Util.html_escape() call. But when rendered as a partial, with a layout, it gets html-escaped when it shouldn't.

@vijaydev
Copy link
Member

vijaydev commented Sep 7, 2011

I could not reproduce this in 3.0.10, 3.1 and edge (all using Ruby 1.8.7). Which Ruby version are you using? Could you test this in 3.1 as well?

@bensomers
Copy link

I will follow up with more details on my issue soon, and test in 3.1. I've been using ruby-1.8.7-p330, but can replicate in REE p253 as well. Still not certain whether or not it is the same root issue.

@gucki
Copy link
Author

gucki commented Sep 29, 2011

I just retested with 3.1.1.rc1 and 3.0.9 and it does seem to be working now.

@gucki gucki closed this as completed Sep 29, 2011
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

3 participants