Changeset 3885 in subversion


Ignore:
Timestamp:
Aug 9, 2010 9:30:17 AM (3 years ago)
Author:
alec
Message:
  • Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898)
Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r3879 r3885  
    11CHANGELOG RoundCube Webmail 
    22=========================== 
     3 
     4- Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898) 
    35 
    46RELEASE 0.4 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r3843 r3885  
    17051705            $this->struct_charset = $this->_structure_charset($structure); 
    17061706 
     1707        $headers->ctype = strtolower($headers->ctype); 
     1708 
    17071709        // Here we can recognize malformed BODYSTRUCTURE and 
    17081710        // 1. [@TODO] parse the message in other way to create our own message structure 
    17091711        // 2. or just show the raw message body. 
    17101712        // Example of structure for malformed MIME message: 
    1711         // ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL) 
    1712         if ($headers->ctype && $headers->ctype != 'text/plain' 
    1713             && $structure[0] == 'text' && $structure[1] == 'plain') { 
    1714             return false; 
     1713        // ("text" "plain" NIL NIL NIL "7bit" 2154 70 NIL NIL NIL) 
     1714        if ($headers->ctype && !is_array($structure[0]) && $headers->ctype != 'text/plain' 
     1715            && strtolower($structure[0].'/'.$structure[1]) == 'text/plain') { 
     1716            // we can handle single-part messages, by simple fix in structure (#1486898) 
     1717            if (preg_match('/^(text|application)\/(.*)/i', $headers->ctype, $m)) { 
     1718                $structure[0] = $m[1]; 
     1719                $structure[1] = $m[2]; 
     1720            } 
     1721            else 
     1722                return false; 
    17151723        } 
    17161724 
Note: See TracChangeset for help on using the changeset viewer.