Changeset 2280 in subversion


Ignore:
Timestamp:
Feb 6, 2009 2:04:45 PM (4 years ago)
Author:
alec
Message:
  • Fix some base64 encoded attachments handling (#1485725)
Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r2277 r2280  
    66- Fix pressing select all/unread multiple times (#1485723) 
    77- Fix selecting all unread does not honor new messages (#1485724) 
     8- Fix some base64 encoded attachments handling (#1485725) 
    89 
    9102009/02/05 (alec) 
  • trunk/roundcubemail/program/lib/imap.inc

    r2273 r2280  
    25092509                        $sizeStr  = substr($line, $from, $len); 
    25102510                        $bytes    = (int)$sizeStr; 
    2511  
     2511                        $prev     = ''; 
     2512                         
    25122513                        while ($bytes > 0) { 
    25132514                                $line      = iil_ReadLine($fp, 1024); 
     
    25192520                                $bytes -= strlen($line); 
    25202521 
     2522                                $line = rtrim($line, "\t\r\n\0\x0B"); 
     2523 
    25212524                                if ($mode == 1) { 
    25222525                                        if ($file) 
    2523                                                 fwrite($file, rtrim($line, "\t\r\n\0\x0B") . "\n"); 
     2526                                                fwrite($file, $line . "\n"); 
    25242527                                        else 
    2525                                                 $result .= rtrim($line, "\t\r\n\0\x0B") . "\n"; 
     2528                                                $result .= $line . "\n"; 
    25262529                                } else if ($mode == 2) { 
    2527                                         echo rtrim($line, "\t\r\n\0\x0B") . "\n"; 
     2530                                        echo $line . "\n"; 
    25282531                                } else if ($mode == 3) { 
     2532                                        // create chunks with proper length for base64 decoding 
     2533                                        $line = $prev.$line; 
     2534                                        $length = strlen($line); 
     2535                                        if ($length % 4) { 
     2536                                                $length = floor($length / 4) * 4; 
     2537                                                $prev = substr($line, $length); 
     2538                                                $line = substr($line, 0, $length); 
     2539                                        } 
     2540                                        else 
     2541                                                $prev = ''; 
     2542 
    25292543                                        if ($file) 
    25302544                                                fwrite($file, base64_decode($line)); 
Note: See TracChangeset for help on using the changeset viewer.