summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-19 09:11:56 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-19 09:13:42 +0100
commit1d719e43fb5f6de7b8d6596c07981e12343f54bd (patch)
tree2b9c4fa6b48d4faa084fdb11d66e7890e243a935
parentec27006ebeef24375dd59c2b952ce98ca8e40084 (diff)
Fix so forward as attachment works if additional attachment is added by message_compose hook (#1489000)
Prevent from re-adding the same forward attachment on compose page refresh Conflicts: CHANGELOG
-rw-r--r--CHANGELOG1
-rw-r--r--program/steps/mail/compose.inc12
2 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a249d848c..e8e664b4f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix so forward as attachment works if additional attachment is added by message_compose hook (#1489000)
- Better handling of session errors in ajax requests (#1488960)
- Fix HTML part detection for some specific message structures (#1488992)
- Don't show fake address - phishing prevention (#1488981)
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 3f86c0d8b..c339fb444 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -559,8 +559,7 @@ function rcmail_prepare_message_body()
else if ($compose_mode == RCUBE_COMPOSE_FORWARD && $COMPOSE['as_attachment']) {
$isHtml = rcmail_compose_editor_mode();
$body = '';
- if (empty($COMPOSE['attachments']))
- rcmail_write_forward_attachments();
+ rcmail_write_forward_attachments();
}
// reply/edit/draft/forward
else if ($compose_mode && ($compose_mode != RCUBE_COMPOSE_REPLY || $RCMAIL->config->get('reply_mode') != -1)) {
@@ -1062,6 +1061,11 @@ function rcmail_write_forward_attachments()
$curr_mem = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB
$names = array();
+ $loaded_attachments = array();
+ foreach ((array)$COMPOSE['attachments'] as $id => $attachment) {
+ $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment;
+ }
+
if ($COMPOSE['forward_uid'] == '*') {
$index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
$COMPOSE['forward_uid'] = $index->get();
@@ -1096,6 +1100,10 @@ function rcmail_write_forward_attachments()
$data = $path = null;
+ if (!empty($loaded_attachments[$name . 'message/rfc822'])) {
+ continue;
+ }
+
// don't load too big attachments into memory
if ($mem_limit > 0 && $message->size > $mem_limit - $curr_mem) {
$temp_dir = unslashify($RCMAIL->config->get('temp_dir'));