fixed sometimes not working download of all attachments via zip (name instead of filename set) and changed it to use streams

This commit is contained in:
Ralf Becker 2014-12-08 18:24:08 +00:00
parent 68151ad8e7
commit 2feacbecb8

View File

@ -2742,15 +2742,16 @@ class mail_ui
$this->mail_bo->reopen($mailbox);
foreach($attachments as $file)
{
$attachment = $this->mail_bo->getAttachment($message_id,$file['partID'],$file['is_winmail'],false);
$attachment = $this->mail_bo->getAttachment($message_id,$file['partID'],$file['is_winmail'],false,true);
$success=true;
if (empty($file['filename'])) $file['filename'] = $file['name'];
if (!($fp = egw_vfs::fopen($path.$file['filename'],'wb')) ||
!fwrite($fp,$attachment['attachment']))
!(!fseek($attachment['attachment'], 0, SEEK_SET) && stream_copy_to_stream($attachment['attachment'], $fp)))
{
$success=false;
egw_framework::message("Unable to zip {$file['filename']}",'error');
}
if (/*$attachment['attachment'] && */$success) $file_list[] = $path.$file['filename'];
if ($success) $file_list[] = $path.$file['filename'];
if ($fp) fclose($fp);
}
$this->mail_bo->closeConnection();