- Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898)

release-0.6
alecpl 15 years ago
parent 119ad13d74
commit 3c9d9aa943

@ -1,6 +1,8 @@
CHANGELOG RoundCube Webmail CHANGELOG RoundCube Webmail
=========================== ===========================
- Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898)
RELEASE 0.4 RELEASE 0.4
----------- -----------
- Fix disapearing upload form disapears when user selects a file on Safari (#1486823) - Fix disapearing upload form disapears when user selects a file on Safari (#1486823)

@ -1704,13 +1704,21 @@ class rcube_imap
else else
$this->struct_charset = $this->_structure_charset($structure); $this->struct_charset = $this->_structure_charset($structure);
$headers->ctype = strtolower($headers->ctype);
// Here we can recognize malformed BODYSTRUCTURE and // Here we can recognize malformed BODYSTRUCTURE and
// 1. [@TODO] parse the message in other way to create our own message structure // 1. [@TODO] parse the message in other way to create our own message structure
// 2. or just show the raw message body. // 2. or just show the raw message body.
// Example of structure for malformed MIME message: // Example of structure for malformed MIME message:
// ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL) // ("text" "plain" NIL NIL NIL "7bit" 2154 70 NIL NIL NIL)
if ($headers->ctype && $headers->ctype != 'text/plain' if ($headers->ctype && !is_array($structure[0]) && $headers->ctype != 'text/plain'
&& $structure[0] == 'text' && $structure[1] == '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; return false;
} }

Loading…
Cancel
Save