diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-01-09 11:19:30 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-01-09 11:19:30 +0100 |
commit | 2eef77c6e349bc29d066068facd26b454d2392b6 (patch) | |
tree | 6cffbe339ffe79618058f3a895e1113d2fb83dfa /plugins/zipdownload/zipdownload.php | |
parent | f67037ce5779929678c9facc5dc925c0e054998d (diff) |
Fix issue where filesystem path was added to all-attachments (zip) file (#1489507)
Diffstat (limited to 'plugins/zipdownload/zipdownload.php')
-rw-r--r-- | plugins/zipdownload/zipdownload.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php index 59431267d..3e3516e49 100644 --- a/plugins/zipdownload/zipdownload.php +++ b/plugins/zipdownload/zipdownload.php @@ -106,9 +106,20 @@ class zipdownload extends rcube_plugin $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE); foreach ($message->attachments as $part) { - $pid = $part->mime_id; - $part = $message->mime_parts[$pid]; - $disp_name = $this->_convert_filename($part->filename); + $pid = $part->mime_id; + $part = $message->mime_parts[$pid]; + $filename = $part->filename; + + if ($filename === null || $filename === '') { + $ext = (array) rcube_mime::get_mime_extensions($part->mimetype); + $ext = array_shift($ext); + $filename = $rcmail->gettext('messagepart') . ' ' . $pid; + if ($ext) { + $filename .= '.' . $ext; + } + } + + $disp_name = $this->_convert_filename($filename); if ($part->body) { $orig_message_raw = $part->body; @@ -205,11 +216,7 @@ class zipdownload extends rcube_plugin $subject = $this->_convert_filename($subject); $subject = substr($subject, 0, 16); - if (isset($subject) && $subject !="") - $disp_name = $subject . ".eml"; - else - $disp_name = "message_rfc822.eml"; - + $disp_name = ($subject ? $subject : 'message_rfc822') . ".eml"; $disp_name = $uid . "_" . $disp_name; $tmpfn = tempnam($temp_dir, 'zipmessage'); |