aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-11-10 14:50:49 +0000
committerLouise Crow <louise.crow@gmail.com>2014-11-10 14:50:49 +0000
commite7c060068edcd2b47cd9b2306364ad2ff12ab0f9 (patch)
tree3ace8af06787732a88ce30a4b179f73b3d236d01 /lib
parentce28b7b52bb931f94a977a55c0fd184dc220e1f5 (diff)
parent30124584b611eaa5747fb8032ce14393c3515a24 (diff)
Merge branch 'rails-3-develop' of ssh://git.mysociety.org/data/git/public/alaveteli into rails-3-develop
Diffstat (limited to 'lib')
-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