Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Undo accidental escaping for mail_to; add regression test. Fix incorr…

…ect credit in changelog. Closes #4202.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3976 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit ab9f32442318ab306df3c5282da56e50cf807d8a 1 parent 83fa114
@seckar seckar authored
View
4 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Undo accidental escaping for mail_to; add regression test. [Nicholas Seckar]
+
* Added nicer message for assert_redirected_to (closes #4294) [court3nay]
assert_redirected_to :action => 'other_host', :only_path => false
@@ -12,7 +14,7 @@
response is not a redirection to all of the options supplied (redirection is <{:only_path=>false, :host=>"other.test.host", :action=>"other_host"}>), difference: <{:only_path=>"true", :host=>"other.test.host"}>
-* Change url_for to escape the resulting URLs when called from a view. [Nicholas Seckar, eddiewould@paradise.net.nz]
+* Change url_for to escape the resulting URLs when called from a view. [Nicholas Seckar, coffee2code]
* Added easy support for testing file uploads with fixture_file_upload #4105 [turnip@turnipspatch.com]. Example:
View
1  actionpack/lib/action_view/helpers/url_helper.rb
@@ -196,7 +196,6 @@ def link_to_if(condition, name, options = {}, html_options = {}, *parameters_for
# mail_to "me@domain.com", "My email", :cc => "ccaddress@domain.com", :bcc => "bccaddress@domain.com", :subject => "This is an example email", :body => "This is the body of the message." # =>
# <a href="mailto:me@domain.com?cc="ccaddress@domain.com"&bcc="bccaddress@domain.com"&body="This%20is%20the%20body%20of%20the%20message."&subject="This%20is%20an%20example%20email">My email</a>
def mail_to(email_address, name = nil, html_options = {})
- name = html_escape(name) if name
html_options = html_options.stringify_keys
encode = html_options.delete("encode")
cc, bcc, subject, body = html_options.delete("cc"), html_options.delete("bcc"), html_options.delete("subject"), html_options.delete("body")
View
4 actionpack/test/template/url_helper_test.rb
@@ -193,6 +193,10 @@ def test_mail_with_options
mail_to("me@example.com", "My email", :cc => "ccaddress@example.com", :bcc => "bccaddress@example.com", :subject => "This is an example email", :body => "This is the body of the message.")
)
end
+
+ def test_mail_to_with_img
+ assert_dom_equal %(<a href="mailto:feedback@example.com"><img src="/feedback.png" /></a>), mail_to('feedback@example.com', '<img src="/feedback.png" />')
+ end
def test_mail_to_with_hex
assert_dom_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">My email</a>", mail_to("me@domain.com", "My email", :encode => "hex")
Please sign in to comment.
Something went wrong with that request. Please try again.