From 5f409583008dfbfa4b5e160f7ec9b1cc7a4766d2 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 12 Oct 2012 06:08:27 -0400
Subject: [PATCH] Fix displaying of multipart/alternative messages with empty parts (#1488750)

---
 CHANGELOG                         |    1 +
 program/include/rcube_message.php |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index b3aef60..ee5e174 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix displaying of multipart/alternative messages with empty parts (#1488750)
 - Fix threaded list sorting on PHP < 5.2.9 (#1488748)
 - Plugin API: Add 'email_list' argument for identities data in user_create hook
 - Integrated zipdownload plugin to download all attachments (#1445509)
diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php
index fe2fcf3..7bf95d1 100644
--- a/program/include/rcube_message.php
+++ b/program/include/rcube_message.php
@@ -371,6 +371,10 @@
             foreach ($structure->parts as $p => $sub_part) {
                 $sub_mimetype = $sub_part->mimetype;
 
+                // skip empty parts
+                if (!$sub_part->size)
+                    continue;
+
                 // check if sub part is
                 if ($sub_mimetype == 'text/plain')
                     $plain_part = $p;

--
Gitblit v1.9.1