From 642775bf62c33bd0042939b006f42cdca925c680 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 8 Dec 2014 18:24:26 +0000 Subject: [PATCH] fixed sometimes not working download of all attachments via zip (name instead of filename set) and changed it to use streams --- mail/inc/class.mail_ui.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 727bc3a677..57b96ff828 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2734,15 +2734,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();