From 66a3b034193ceef1315ab68ceaf6789ccbf882eb Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 12 Sep 2011 04:49:47 -0400
Subject: [PATCH] - Fix handling of binary attachments encoded with quoted-printable (#1488065)

---
 CHANGELOG                              |    1 +
 program/include/rcube_imap.php         |    3 +++
 program/include/rcube_imap_generic.php |    2 --
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6c04389..63a8c80 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix handling of binary attachments encoded with quoted-printable (#1488065)
 - Fix text-overflow:ellipsis issues on messages list in FF7 and Webkit (#1488061)
 - Fix setting title for truncated subject in IE (#1487128)
 - Fix handling of links with IP address
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index dfbee76..ce8bb0f 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2386,6 +2386,9 @@
             return true;
         }
 
+        // Remove NULL characters (#1486189)                                                                                      
+        $body = str_replace("\x00", '', $body);
+
         // convert charset (if text or message part)
         if ($body && !$skip_charset_conv &&
             preg_match('/^(text|message)$/', $o_part->ctype_primary)
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 65b2025..be520d3 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -2470,8 +2470,6 @@
                 } else if ($mode == 2) {
                     $line = rtrim($line, "\t\r\0\x0B");
                     $line = quoted_printable_decode($line);
-                    // Remove NULL characters (#1486189)
-                    $line = str_replace("\x00", '', $line);
                 // UUENCODE
                 } else if ($mode == 3) {
                     $line = rtrim($line, "\t\r\n\0\x0B");

--
Gitblit v1.9.1