diff options
author | Rafael França <rafael@franca.dev> | 2019-07-25 22:14:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-25 22:14:37 -0400 |
commit | e53e25328094f86cbfa7d0e77fb2618a0a2b3518 (patch) | |
tree | 9a90748fc70e1e0add528cf85b935bcb69b9cef2 | |
parent | 65dcc9d1597b5472ed59ea6c73686d48942f76f6 (diff) | |
parent | ce88f6bd2561f3ff31e39c70ae82b301ee0ddd79 (diff) | |
download | rails-e53e25328094f86cbfa7d0e77fb2618a0a2b3518.tar.gz rails-e53e25328094f86cbfa7d0e77fb2618a0a2b3518.tar.bz2 rails-e53e25328094f86cbfa7d0e77fb2618a0a2b3518.zip |
Merge pull request #36765 from kylekeesling/patch-1
fix filenames of attachments created via the inbound email conductor
-rw-r--r-- | actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb | 2 | ||||
-rw-r--r-- | actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb b/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb index 8713f545f5..cd8b12dcde 100644 --- a/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb +++ b/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb @@ -23,7 +23,7 @@ module Rails Mail.new(params.require(:mail).permit(:from, :to, :cc, :bcc, :in_reply_to, :subject, :body).to_h).tap do |mail| mail[:bcc]&.include_in_headers = true params[:mail][:attachments].to_a.each do |attachment| - mail.add_file(filename: attachment.path, content: attachment.read) + mail.add_file(filename: attachment.original_filename, content: attachment.read) end end end diff --git a/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb index 6fc39c2433..ad13faf36c 100644 --- a/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb +++ b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb @@ -45,8 +45,10 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa end mail = ActionMailbox::InboundEmail.last.mail + attachment_filenames = mail.attachments.map(&:filename) assert_equal "Let's talk about these images:", mail.text_part.decoded assert_equal 2, mail.attachments.count + assert_equal attachment_filenames, ["avatar1.jpeg", "avatar2.jpeg"] end end |