From 54029ea959b5f59447e3f0a01a453fd5fe0ba8fa Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 21 Dec 2013 08:49:00 -0500
Subject: [PATCH] Fix broken text/* attachments when forwarding/editing a message (#1489426)

---
 program/lib/Roundcube/rcube_imap.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index dc53058..f1363ca 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -2121,7 +2121,7 @@
         // convert charset (if text or message part)
         if ($body && preg_match('/^(text|message)$/', $o_part->ctype_primary)) {
             // Remove NULL characters if any (#1486189)
-            if (strpos($body, "\x00") !== false) {
+            if ($formatted && strpos($body, "\x00") !== false) {
                 $body = str_replace("\x00", '', $body);
             }
 

--
Gitblit v1.9.1