Skip to content

Commit

Permalink
Make sure anything with content-disposition of "attachment" is passed…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
jamis committed Jan 23, 2006
1 parent acfb8b6 commit 185cca2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions actionmailer/CHANGELOG
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,7 @@
*SVN* *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] * 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.] * Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/lib/action_mailer/vendor/tmail/quoting.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def body(to_charset = 'utf-8', &block)
part.body(to_charset, &attachment_presenter) part.body(to_charset, &attachment_presenter)
elsif header.nil? elsif header.nil?
"" ""
elsif header.main_type == "text" elsif !attachment?(part)
part.unquoted_body(to_charset) part.unquoted_body(to_charset)
else else
attachment_presenter.call(header["name"] || "(unnamed)") attachment_presenter.call(header["name"] || "(unnamed)")
Expand Down
10 changes: 10 additions & 0 deletions actionmailer/test/fixtures/raw_email7
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ Content-Type: text/plain;


This is the first part. 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 --Apple-Mail-12-196940926
Content-Transfer-Encoding: base64 Content-Transfer-Encoding: base64
Content-Type: application/pdf; Content-Type: application/pdf;
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/test/mail_service_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def test_headers_removed_on_smtp_delivery
def test_recursive_multipart_processing def test_recursive_multipart_processing
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email7") fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email7")
mail = TMail::Mail.parse(fixture) 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 end


def test_decode_encoded_attachment_filename def test_decode_encoded_attachment_filename
Expand Down

0 comments on commit 185cca2

Please sign in to comment.