From 292292df32a5d3f8db2cfc266fb4a8f7dbf52468 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 08 Apr 2015 02:56:42 -0400
Subject: [PATCH] Fix so unrecognized TNEF attachments are displayed on the list of attachments (#1490351)

---
 program/lib/Roundcube/rcube_message.php |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index 449a3c3..6c6248e 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -739,10 +739,19 @@
                 }
                 // part is Microsoft Outlook TNEF (winmail.dat)
                 else if ($part_mimetype == 'application/ms-tnef') {
-                    foreach ((array)$this->tnef_decode($mail_part) as $tpart) {
+                    $tnef_parts = (array) $this->tnef_decode($mail_part);
+                    foreach ($tnef_parts as $tpart) {
                         $this->mime_parts[$tpart->mime_id] = $tpart;
                         $this->attachments[] = $tpart;
                     }
+
+                    // add winmail.dat to the list if it's content is unknown
+                    if (empty($tnef_parts) && !empty($mail_part->filename)) {
+                        $this->mime_parts[$mail_part->mime_id] = $mail_part;
+                        $this->attachments[] = $mail_part;
+                    }
+
+                    $tnef_parts = null;
                 }
                 // part is a file/attachment
                 else if (preg_match('/^(inline|attach)/', $mail_part->disposition) ||

--
Gitblit v1.9.1