chwala issue on debian wheezy

Szota, Marcin msz at msz.katowice.pl
Tue Mar 3 17:11:24 CET 2015


thanks, that helped.

since it's related with php-mail-mime upgrade from 1.8.4 to >=1.8.5 all 
upgrades of kolab from 3.3 to 3.4 on debian whzeezy going to have the 
same issue.


W dniu 2015-03-03 15:20, Aleksander Machniak napisał(a):
> On 03/03/2015 03:01 PM, Szota, Marcin wrote:
>> i'm just guessing it's all about that size doesn't exist
> 
> Yes, it is. Here's a php script I used once to fix broken files.
> 
> <?php
> 
> $file    = $_SERVER['argv'][1];
> $content = file_get_contents($file);
> $header  = substr($content, 0, strpos($content, "\r\n\r\n"));
> 
> if (!preg_match('/X-Kolab-Type: application\/x-vnd\.kolab\.file/',
> $header)) {
>     echo "Not a file object: $file!\n";
>     exit(1);
> }
> if (!preg_match('/boundary="([a-z0-9=_]+)"/', $header, $m)) {
>     echo "Boundary not found in file $file!\n";
>     exit(1);
> }
> 
> $separator = "--" . $m[1];
> $content   = explode($separator, $content);
> $end_part  = array_pop($content);
> $file_part = array_pop($content);
> 
> list($headers, $file_part) = explode("\r\n\r\n", $file_part);
> 
> // sanity check
> if (!preg_match('/Content-Transfer-Encoding: base64/i', $headers)) {
>     echo "Malformed message [1]?!\n";
>     exit(1);
> }
> if (!preg_match('/Content-Disposition: attachment/i', $headers)) {
>     echo "Malformed message [2]?!\n";
>     exit(1);
> }
> 
> if (preg_match('/[\s\t]size=/', $headers)) {
>     // size parameter already exists
>     exit;
> }
> 
> // calculate size
> $decoded = base64_decode($file_part);
> $size    = strlen($decoded);
> unset($decoded);
> 
> if (!$size) {
>     // error or empty file
>     exit;
> }
> 
> $headers = rtrim($headers) . ";\r\n size=$size";
> 
> // build the message back
> $content = implode($content, $separator);
> $content .= $separator . "\r\n";
> $content .= ltrim($headers) . "\r\n\r\n";
> $content .= $file_part . "\r\n\r\n";
> $content .= $separator . $end_part;
> 
> // overwrite the file with new content
> file_put_contents($file, $content);
> 
> ?>
> 
> After executing it on every file in imap folder, you'd need to do the
> mailbox/folder reconstruct and clear the Roundcube cache 
> (kolab_cache_file).


More information about the users mailing list