summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-10-22 19:02:23 +0200
committerAleksander Machniak <alec@alec.pl>2014-10-22 19:02:23 +0200
commit2268aa676d4f21f0f26b4c802c6fb9c2c631d206 (patch)
treefba930554cd7ba33e23fc28138889392101c4c23
parentd165d11012a3814b129b3dab6419212bad8e5872 (diff)
Fix handling of uuencoded messages if messages_cache is enabled (#1490108)
-rw-r--r--CHANGELOG1
-rw-r--r--program/lib/Roundcube/rcube_imap_cache.php10
-rw-r--r--program/lib/Roundcube/rcube_message.php9
3 files changed, 9 insertions, 11 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 978fad2fb..f5ac7a197 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -56,6 +56,7 @@ CHANGELOG Roundcube Webmail
- Fix displaying of HTML messages with absolutely positioned elements in Larry skin (#1490103)
- Fix font style display issue in HTML messages with styled <span> elements (#1490101)
- Fix download of attachments that are part of TNEF message (#1490091)
+- Fix handling of uuencoded messages if messages_cache is enabled (#1490108)
RELEASE 1.0.3
-------------
diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php
index 95498e364..81df07641 100644
--- a/program/lib/Roundcube/rcube_imap_cache.php
+++ b/program/lib/Roundcube/rcube_imap_cache.php
@@ -1245,13 +1245,15 @@ class rcube_imap_cache
private function message_object_prepare(&$msg, &$size = 0)
{
// Remove body too big
- if ($msg->body && ($length = strlen($msg->body))) {
- $size += $length;
+ if (isset($msg->body)) {
+ $length = strlen($msg->body);
- if ($size > $this->threshold * 1024) {
- $size -= $length;
+ if ($msg->body_modified || $size + $length > $this->threshold * 1024) {
unset($msg->body);
}
+ else {
+ $size += $length;
+ }
}
// Fix mimetype which might be broken by some code when message is displayed
diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index a00f6bfa5..4f0f0fd1f 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -899,13 +899,6 @@ class rcube_message
break;
}
- // update message content-type
- if ($part->mimetype != 'multipart/mixed') {
- $part->ctype_primary = 'multipart';
- $part->ctype_secondary = 'mixed';
- $part->mimetype = $part->ctype_primary . '/' . $part->ctype_secondary;
- }
-
$endpos = $m[0][1];
$begin_len = strlen($matches[0][0]);
$end_len = strlen($m[0][0]);
@@ -916,6 +909,8 @@ class rcube_message
// remove attachment body from the message body
$part->body = substr_replace($part->body, '', $startpos, $endpos + $end_len - $startpos);
+ // mark body as modified so it will not be cached by rcube_imap_cache
+ $part->body_modified = true;
// add attachments to the structure
$uupart = new rcube_message_part;