summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_imap.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-08-09 13:30:17 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-08-09 13:30:17 +0000
commitdac9bf709120ffa0028a638732f1159cd66ddfcd (patch)
tree24a9b1ddf0a3dd43950f0110028b56318645f131 /roundcubemail/program/include/rcube_imap.php
parent325d46eb63f058eb3476a30be9552a6f11c34794 (diff)
- Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898)
git-svn-id: https://svn.roundcube.net/trunk@3885 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
-rw-r--r--roundcubemail/program/include/rcube_imap.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php
index 4dd46e95f..57667229d 100644
--- a/roundcubemail/program/include/rcube_imap.php
+++ b/roundcubemail/program/include/rcube_imap.php
@@ -1704,14 +1704,22 @@ class rcube_imap
else
$this->struct_charset = $this->_structure_charset($structure);
+ $headers->ctype = strtolower($headers->ctype);
+
// Here we can recognize malformed BODYSTRUCTURE and
// 1. [@TODO] parse the message in other way to create our own message structure
// 2. or just show the raw message body.
// Example of structure for malformed MIME message:
- // ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL)
- if ($headers->ctype && $headers->ctype != 'text/plain'
- && $structure[0] == 'text' && $structure[1] == 'plain') {
- return false;
+ // ("text" "plain" NIL NIL NIL "7bit" 2154 70 NIL NIL NIL)
+ if ($headers->ctype && !is_array($structure[0]) && $headers->ctype != 'text/plain'
+ && strtolower($structure[0].'/'.$structure[1]) == 'text/plain') {
+ // we can handle single-part messages, by simple fix in structure (#1486898)
+ if (preg_match('/^(text|application)\/(.*)/i', $headers->ctype, $m)) {
+ $structure[0] = $m[1];
+ $structure[1] = $m[2];
+ }
+ else
+ return false;
}
$struct = &$this->_structure_part($structure);