aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/incoming_message.rb5
-rw-r--r--lib/mail_handler/backends/tmail_backend.rb8
2 files changed, 9 insertions, 4 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index bb6c9dc21..b059b143f 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -593,10 +593,7 @@ class IncomingMessage < ActiveRecord::Base
def extract_attachments!
force = true
- leaves = MailHandler.get_attachment_leaves(self.mail(force)) # XXX check where else this is called from
- # XXX we have to call MailHandler.ensure_parts_counted after get_attachment_leaves
- # which is really messy.
- MailHandler.ensure_parts_counted(self.mail)
+ leaves = MailHandler.get_attachment_attributes(self.mail(force))
attachments = []
for leaf in leaves
body = MailHandler.get_part_body(leaf)
diff --git a/lib/mail_handler/backends/tmail_backend.rb b/lib/mail_handler/backends/tmail_backend.rb
index 92d478541..9bcc2ab1f 100644
--- a/lib/mail_handler/backends/tmail_backend.rb
+++ b/lib/mail_handler/backends/tmail_backend.rb
@@ -130,6 +130,14 @@ module MailHandler
end
end
+ def get_attachment_attributes(mail)
+ leaves = get_attachment_leaves(mail)
+ # XXX we have to call ensure_parts_counted after get_attachment_leaves
+ # which is really messy.
+ ensure_parts_counted(mail)
+ leaves
+ end
+
# (This risks losing info if the unchosen alternative is the only one to contain
# useful info, but let's worry about that another time)
def get_attachment_leaves(mail)