summaryrefslogtreecommitdiff
path: root/plugins/zipdownload
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-10-22 14:29:44 +0200
committerAleksander Machniak <alec@alec.pl>2014-10-22 14:29:44 +0200
commit48ba4414b33c8982f8232b06f06d68f3213aa986 (patch)
treec36c555e1e2cca6cfe1fdd12018da05b648798b9 /plugins/zipdownload
parente2251db1d5b536f61fe7db57b96a9601465bd139 (diff)
Fix download of attachments that are part of TNEF message (#1490091)
Rcube_message_part::body content should never be modified by code out of the rcube_message. Added convenient rcube_message::get_part_body() method, making rcube_message::get_part_content() deprecated.
Diffstat (limited to 'plugins/zipdownload')
-rw-r--r--plugins/zipdownload/zipdownload.php20
1 files changed, 7 insertions, 13 deletions
diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php
index edb8188cc..2e103ceb0 100644
--- a/plugins/zipdownload/zipdownload.php
+++ b/plugins/zipdownload/zipdownload.php
@@ -144,20 +144,14 @@ class zipdownload extends rcube_plugin
}
}
- $disp_name = $this->_convert_filename($filename);
+ $disp_name = $this->_convert_filename($filename);
+ $tmpfn = tempnam($temp_dir, 'zipattach');
+ $tmpfp = fopen($tmpfn, 'w');
+ $tempfiles[] = $tmpfn;
- if ($part->body) {
- $orig_message_raw = $part->body;
- $zip->addFromString($disp_name, $orig_message_raw);
- }
- else {
- $tmpfn = tempnam($temp_dir, 'zipattach');
- $tmpfp = fopen($tmpfn, 'w');
- $imap->get_message_part($message->uid, $part->mime_id, $part, null, $tmpfp, true);
- $tempfiles[] = $tmpfn;
- fclose($tmpfp);
- $zip->addFile($tmpfn, $disp_name);
- }
+ $message->get_part_body($part->mime_id, false, 0, $tmpfp);
+ $zip->addFile($tmpfn, $disp_name);
+ fclose($tmpfp);
}
$zip->close();