From 8acf6204b1b56388cab8fc3db67b686fb950ba0e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 08 Jul 2013 02:47:13 -0400
Subject: [PATCH] Fix "could not load message" error on valid empty message body (#1489228)

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

diff --git a/CHANGELOG b/CHANGELOG
index 8e5eadb..d2f447a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix "could not load message" error on valid empty message body (#1489228)
 - Check filetype detection in installer and update script (#1489193)
 - Fix handling of message/rfc822 attachments on message forward and edit (#1489214)
 - Fix folder names truncation in Classic skin (#1489220)
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index 9b11624..70ffd0d 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -2543,7 +2543,11 @@
                 $prev  = '';
                 $found = true;
 
-                while ($bytes > 0) {
+                // empty body
+                if (!$bytes) {
+                    $result = '';
+                }
+                else while ($bytes > 0) {
                     $line = $this->readLine(8192);
 
                     if ($line === NULL) {

--
Gitblit v1.9.1