aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mail_handler/backends/mail_backend.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-11-10 11:32:04 +0000
committerGareth Rees <gareth@mysociety.org>2014-11-10 11:32:04 +0000
commitcaf31f089b8bce94eb80ee168bbb74ca8ccdafb6 (patch)
tree5e91e51e53b7d6ff2e5865246357b5db188bf998 /lib/mail_handler/backends/mail_backend.rb
parented778bbf1022d6f06bdb82d004c99a2cee22b673 (diff)
parent401f44b19bbe9defca7623fdf5436b94d06def83 (diff)
Merge branch 'issues/1437-apple-mail-attachment-parsing' into rails-3-develop
Diffstat (limited to 'lib/mail_handler/backends/mail_backend.rb')
-rw-r--r--lib/mail_handler/backends/mail_backend.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 190e79e97..ae3077a72 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -248,6 +248,9 @@ module MailHandler
# Choose the best part from alternatives
def choose_best_alternative(mail)
+ if mail.parts.any?(&:multipart?)
+ return mail.parts.detect(&:multipart?)
+ end
if mail.html_part
return mail.html_part
elsif mail.text_part
@@ -261,6 +264,7 @@ module MailHandler
# wherever there is an alternative, and then count the returned
# leaves and assign url_part values to them
def get_attachment_leaves(mail)
+ # TODO: Most of these methods are modifying in place! :(
expand_and_normalize_parts(mail, mail)
leaves = _get_attachment_leaves_recursive(mail, nil, mail)
mail.count_parts_count = 0