1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Nil charset caused subject line to be improperly quoted in implicitly multipart messages (closes #2662)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3960 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2006-03-19 00:18:50 +00:00
parent db0e8ff1c3
commit 49efa02b9e
3 changed files with 19 additions and 2 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Nil charset caused subject line to be improperly quoted in implicitly multipart messages #2662 [ehalvorsen+rails@runbox.com]
* Parse content-type apart before using it so that sub-parts of the header can be set correctly #2918 [Jamis Buck]
* Make custom headers work in subparts #4034 [elan@bluemandrill.com]

View file

@ -293,7 +293,6 @@ module ActionMailer
end
unless @parts.empty?
@content_type = "multipart/alternative"
@charset = nil
@parts = sort_parts(@parts, @implicit_parts_order)
end
end
@ -432,7 +431,10 @@ module ActionMailer
m.parts << part
end
m.set_content_type(real_content_type, nil, ctype_attrs) if real_content_type =~ /multipart/
if real_content_type =~ /multipart/
ctype_attrs.delete "charset"
m.set_content_type(real_content_type, nil, ctype_attrs)
end
end
@mail = m

View file

@ -167,6 +167,14 @@ class TestMailer < ActionMailer::Base
@implicit_parts_order = order if order
end
def implicitly_multipart_with_utf8
recipients "no.one@nowhere.test"
subject "Foo áëô îü"
from "some.one@somewhere.test"
template "implicitly_multipart_example"
body ({ "recipient" => "no.one@nowhere.test" })
end
def html_mail(recipient)
recipients recipient
subject "html mail"
@ -646,6 +654,11 @@ EOF
assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
end
def test_implicitly_multipart_with_utf8
mail = TestMailer.create_implicitly_multipart_with_utf8
assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
end
def test_explicitly_multipart_messages
mail = TestMailer.create_explicitly_multipart_example(@recipient)
assert_equal 3, mail.parts.length