mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add proper fix to mail_to
helper.
* Fix the problem on manipulating on the `ActiveSupport::SafeBuffer` * Make sure that we run `escape_javascript` on the `String`, to avoid unexpected behavior.
This commit is contained in:
parent
07f2481e15
commit
9e2e242655
1 changed files with 2 additions and 2 deletions
|
@ -497,14 +497,14 @@ module ActionView
|
|||
}.compact
|
||||
extras = extras.empty? ? '' : '?' + ERB::Util.html_escape(extras.join('&'))
|
||||
|
||||
email_address_obfuscated = email_address.dup
|
||||
email_address_obfuscated = email_address.to_str
|
||||
email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.key?("replace_at")
|
||||
email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.key?("replace_dot")
|
||||
case encode
|
||||
when "javascript"
|
||||
string = ''
|
||||
html = content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge("href" => "mailto:#{email_address}#{extras}".html_safe))
|
||||
html = escape_javascript(html)
|
||||
html = escape_javascript(html.to_str)
|
||||
"document.write('#{html}');".each_byte do |c|
|
||||
string << sprintf("%%%x", c)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue