summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-06-06 09:35:56 +0200
committerAleksander Machniak <alec@alec.pl>2012-06-06 09:35:56 +0200
commitbdb40d39bd7921a97e530dac3ef0759a6752b5c6 (patch)
treef8036d876ac9d5ae924e15e40299ce8bbb0cd9f7 /program
parenteede5101cda06c5f64ddbdc3cd71e8351eaabd2b (diff)
Add workaround for invalid BODYSTRUCTURE response - parse message with Mail_mimeDecode package (#1485585)
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 84b0fc11f..00a4158fe 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1635,11 +1635,24 @@ class rcube_imap extends rcube_storage
$structure[1] = $m[2];
}
else {
- return $headers;
+ // Try to parse the message using Mail_mimeDecode package
+ // We need a better solution, Mail_mimeDecode parses message
+ // in memory, which wouldn't work for very big messages,
+ // (it uses up to 10x more memory than the message size)
+ // it's also buggy and not actively developed
+ if ($headers->size && rcube_utils::mem_check($headers->size * 10)) {
+ $raw_msg = $this->get_raw_body($uid);
+ $struct = rcube_mime::parse_message($raw_msg);
+ }
+ else {
+ return $headers;
+ }
}
}
- $struct = $this->structure_part($structure, 0, '', $headers);
+ if (empty($struct)) {
+ $struct = $this->structure_part($structure, 0, '', $headers);
+ }
// don't trust given content-type
if (empty($struct->parts) && !empty($headers->ctype)) {