From 8c32f881933c19e57b9148149d1c86eb802be3ff Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 07 Feb 2014 08:45:19 -0500
Subject: [PATCH] Fixed typo in script output

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

diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index 9b662a2..f24ec3e 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -211,16 +211,19 @@
                 }
 
                 $level = explode('.', $part->mime_id);
+                $depth = count($level);
 
                 // Check if the part belongs to higher-level's multipart part
-                // this can be alternative/related/signed/encrypted, but not mixed
+                // this can be alternative/related/signed/encrypted or mixed
                 while (array_pop($level) !== null) {
-                    if (!count($level)) {
+                    $parent_depth = count($level);
+                    if (!$parent_depth) {
                         return true;
                     }
 
                     $parent = $this->mime_parts[join('.', $level)];
-                    if (!preg_match('/^multipart\/(alternative|related|signed|encrypted)$/', $parent->mimetype)) {
+                    if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $parent->mimetype)
+                        || ($parent->mimetype == 'multipart/mixed' && $parent_depth < $depth - 1)) {
                         continue 2;
                     }
                 }
@@ -529,8 +532,9 @@
                     $part_mimetype = $mail_part->real_mimetype;
                     list($primary_type, $secondary_type) = explode('/', $part_mimetype);
                 }
-                else
-                    $part_mimetype = $mail_part->mimetype;
+                else {
+                    $part_mimetype = $part_orig_mimetype = $mail_part->mimetype;
+                  }
 
                 // multipart/alternative
                 if ($primary_type == 'multipart') {

--
Gitblit v1.9.1