diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-07-24 15:44:23 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-07-24 15:44:23 -0300 |
commit | 9caf2cbf268137113447ac8156b862b5d84063b5 (patch) | |
tree | 99082229f183775d0ea9533fec5515609bd5e3b2 /actionview/lib | |
parent | d937a1175f10586b892842348c1d6ecaa47aad2e (diff) | |
parent | 6a387824775430fef2a0075ddd7b9d31e8c5cb48 (diff) | |
download | rails-9caf2cbf268137113447ac8156b862b5d84063b5.tar.gz rails-9caf2cbf268137113447ac8156b862b5d84063b5.tar.bz2 rails-9caf2cbf268137113447ac8156b862b5d84063b5.zip |
Merge pull request #21007 from clayton-shopify/fix-mailto-encoding
Encode the email address as prescribed in RFC 6068 section 2.
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/url_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index afb1265ad9..7d92651183 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -468,7 +468,8 @@ module ActionView }.compact extras = extras.empty? ? '' : '?' + extras.join('&') - html_options["href"] = "mailto:#{email_address}#{extras}" + encoded_email_address = ERB::Util.url_encode(email_address).gsub("%40", "@") + html_options["href"] = "mailto:#{encoded_email_address}#{extras}" content_tag(:a, name || email_address, html_options, &block) end |