mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Template paths with dot chars in them no longer mess up implicit template selection for multipart messages (closes #3332)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3495 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
01b1a87729
commit
34df9be0e5
5 changed files with 25 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler]
|
||||||
|
|
||||||
* Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck]
|
* Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck]
|
||||||
|
|
||||||
* Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type [Jamis Buck]
|
* Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type [Jamis Buck]
|
||||||
|
|
|
@ -25,7 +25,7 @@ Rake::TestTask.new { |t|
|
||||||
t.libs << "test"
|
t.libs << "test"
|
||||||
t.pattern = 'test/*_test.rb'
|
t.pattern = 'test/*_test.rb'
|
||||||
t.verbose = true
|
t.verbose = true
|
||||||
t.warning = true
|
t.warning = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ module ActionMailer
|
||||||
# normal template exists (or if there were no implicit parts) we render
|
# normal template exists (or if there were no implicit parts) we render
|
||||||
# it.
|
# it.
|
||||||
template_exists = @parts.empty?
|
template_exists = @parts.empty?
|
||||||
template_exists ||= Dir.glob("#{template_path}/#{@template}.*").any? { |i| i.split(".").length == 2 }
|
template_exists ||= Dir.glob("#{template_path}/#{@template}.*").any? { |i| File.basename(i).split(".").length == 2 }
|
||||||
@body = render_message(@template, @body) if template_exists
|
@body = render_message(@template, @body) if template_exists
|
||||||
|
|
||||||
# Finally, if there are other message parts and a textual body exists,
|
# Finally, if there are other message parts and a textual body exists,
|
||||||
|
|
1
actionmailer/test/fixtures/path.with.dots/multipart_with_template_path_with_dots.rhtml
vendored
Normal file
1
actionmailer/test/fixtures/path.with.dots/multipart_with_template_path_with_dots.rhtml
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Have a lovely picture, from me. Enjoy!
|
|
@ -23,6 +23,20 @@ class Net::SMTP
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class FunkyPathMailer < ActionMailer::Base
|
||||||
|
def multipart_with_template_path_with_dots(recipient)
|
||||||
|
recipients recipient
|
||||||
|
subject "Have a lovely picture"
|
||||||
|
from "Chad Fowler <chad@chadfowler.com>"
|
||||||
|
attachment :content_type => "image/jpeg",
|
||||||
|
:body => "not really a jpeg, we're only testing, after all"
|
||||||
|
end
|
||||||
|
|
||||||
|
def template_path
|
||||||
|
"#{File.dirname(__FILE__)}/fixtures/path.with.dots"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class TestMailer < ActionMailer::Base
|
class TestMailer < ActionMailer::Base
|
||||||
|
|
||||||
def signed_up(recipient)
|
def signed_up(recipient)
|
||||||
|
@ -748,9 +762,14 @@ EOF
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_deliver_with_mail_object
|
def test_deliver_with_mail_object
|
||||||
mail = TestMailer::create_headers_with_nonalpha_chars(@recipient)
|
mail = TestMailer.create_headers_with_nonalpha_chars(@recipient)
|
||||||
assert_nothing_raised { TestMailer.deliver(mail) }
|
assert_nothing_raised { TestMailer.deliver(mail) }
|
||||||
assert_equal 1, TestMailer.deliveries.length
|
assert_equal 1, TestMailer.deliveries.length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_multipart_with_template_path_with_dots
|
||||||
|
mail = FunkyPathMailer.create_multipart_with_template_path_with_dots(@recipient)
|
||||||
|
assert_equal 2, mail.parts.length
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue