aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-01-23 16:48:24 +0000
committerJamis Buck <jamis@37signals.com>2006-01-23 16:48:24 +0000
commit185cca238bc1df79a3bb438679bbbeb980f82078 (patch)
treeee8bcd6e0585e77e1028cd675baba51438300a98
parentacfb8b6191338cdb04707e2e1e8ac1cdbb595b4f (diff)
downloadrails-185cca238bc1df79a3bb438679bbbeb980f82078.tar.gz
rails-185cca238bc1df79a3bb438679bbbeb980f82078.tar.bz2
rails-185cca238bc1df79a3bb438679bbbeb980f82078.zip
Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3475 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionmailer/CHANGELOG2
-rw-r--r--actionmailer/lib/action_mailer/vendor/tmail/quoting.rb2
-rw-r--r--actionmailer/test/fixtures/raw_email710
-rwxr-xr-xactionmailer/test/mail_service_test.rb2
4 files changed, 14 insertions, 2 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG
index ce95327ba2..00c672788c 100644
--- a/actionmailer/CHANGELOG
+++ b/actionmailer/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* 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]
* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
diff --git a/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb b/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb
index 36bf03f0a3..a56e2267ee 100644
--- a/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb
+++ b/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb
@@ -33,7 +33,7 @@ module TMail
part.body(to_charset, &attachment_presenter)
elsif header.nil?
""
- elsif header.main_type == "text"
+ elsif !attachment?(part)
part.unquoted_body(to_charset)
else
attachment_presenter.call(header["name"] || "(unnamed)")
diff --git a/actionmailer/test/fixtures/raw_email7 b/actionmailer/test/fixtures/raw_email7
index 251172a71f..da64ada8a5 100644
--- a/actionmailer/test/fixtures/raw_email7
+++ b/actionmailer/test/fixtures/raw_email7
@@ -22,6 +22,16 @@ Content-Type: text/plain;
This is the first part.
--Apple-Mail-12-196940926
+Content-Transfer-Encoding: 7bit
+Content-Type: text/x-ruby-script;
+ x-unix-mode=0666;
+ name="test.rb"
+Content-Disposition: attachment;
+ filename=test.rb
+
+puts "testing, testing"
+
+--Apple-Mail-12-196940926
Content-Transfer-Encoding: base64
Content-Type: application/pdf;
x-unix-mode=0666;
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 94dd70200b..4d569da31f 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -704,7 +704,7 @@ EOF
def test_recursive_multipart_processing
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email7")
mail = TMail::Mail.parse(fixture)
- assert_equal "This is the first part.\n\nAttachment: test.pdf\n\n\nAttachment: smime.p7s\n", mail.body
+ assert_equal "This is the first part.\n\nAttachment: test.rb\nAttachment: test.pdf\n\n\nAttachment: smime.p7s\n", mail.body
end
def test_decode_encoded_attachment_filename