From 9dd3559ee4539b5bb88ee03f71875bf38c8f9fde Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 17 Apr 2015 05:07:09 -0400
Subject: [PATCH] Fix bug where some unrelated attachments in multipart/related message were not listed (#1490355)

---
 program/lib/Roundcube/rcube_message.php |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index 8db1742..a3bc4e2 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -570,8 +570,10 @@
                     $related_part = $p;
                 else if ($sub_mimetype == 'text/plain' && !$plain_part)
                     $plain_part = $p;
-                else if ($sub_mimetype == 'text/html' && !$html_part)
+                else if ($sub_mimetype == 'text/html' && !$html_part) {
                     $html_part = $p;
+                    $this->got_html_part = true;
+                }
                 else if ($sub_mimetype == 'text/enriched' && !$enriched_part)
                     $enriched_part = $p;
                 else {
@@ -696,7 +698,7 @@
                         continue;
 
                     if ($part_mimetype == 'text/html' && $mail_part->size) {
-                        $got_html_part = true;
+                        $this->got_html_part = true;
                     }
 
                     $mail_part = $plugin['structure'];
@@ -809,7 +811,7 @@
                         // MS Outlook sends sometimes non-related attachments as related
                         // In this case multipart/related message has only one text part
                         // We'll add all such attachments to the attachments list
-                        if (!isset($got_html_part) && empty($inline_object->content_id)) {
+                        if (!isset($this->got_html_part)) {
                             $this->attachments[] = $inline_object;
                         }
                         // MS Outlook sometimes also adds non-image attachments as related

--
Gitblit v1.9.1