diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-11-16 00:33:14 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-16 09:59:15 -0200 |
commit | 666a7e34f553cef4c8878362eafc79c7e3f310c3 (patch) | |
tree | 85ed6e0dd3a97e1d70ecce0b13e528c034f98046 /actionpack/lib/action_view/template/handlers | |
parent | f2a98a9243a3eb078efa11b901a6b6446e89717e (diff) | |
download | rails-666a7e34f553cef4c8878362eafc79c7e3f310c3.tar.gz rails-666a7e34f553cef4c8878362eafc79c7e3f310c3.tar.bz2 rails-666a7e34f553cef4c8878362eafc79c7e3f310c3.zip |
Merge pull request #8235 from tilsammans/dont_escape_actionmailer_when_plaintext
Introduce `ActionView::Template::Handlers::ERB.escape_whitelist`
Conflicts:
actionpack/CHANGELOG.md
actionpack/test/template/template_test.rb
Diffstat (limited to 'actionpack/lib/action_view/template/handlers')
-rw-r--r-- | actionpack/lib/action_view/template/handlers/erb.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template/handlers/erb.rb b/actionpack/lib/action_view/template/handlers/erb.rb index ea495ea9ca..6cc6a8f8ed 100644 --- a/actionpack/lib/action_view/template/handlers/erb.rb +++ b/actionpack/lib/action_view/template/handlers/erb.rb @@ -48,6 +48,10 @@ module ActionView class_attribute :erb_implementation self.erb_implementation = Erubis + # Do not escape templates of these mime types. + class_attribute :escape_whitelist + self.escape_whitelist = ["text/plain"] + ENCODING_TAG = Regexp.new("\\A(<%#{ENCODING_FLAG}-?%>)[ \\t]*") def self.call(template) @@ -83,6 +87,7 @@ module ActionView self.class.erb_implementation.new( erb, + :escape => (self.class.escape_whitelist.include? template.mime_type), :trim => (self.class.erb_trim_mode == "-") ).src end |