diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-03-02 00:12:04 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-03-02 00:12:04 +0100 |
commit | 5688d5baa28e310467528c4f3c187bf8f6edf0fb (patch) | |
tree | b5752d9f87fa63ba21c3955cae5b1fccc387eed3 | |
parent | f0a7159c401983e7dbc9620582124f90f3e4eadc (diff) |
Avoid loading already registered attachments when opening a draft message (on page reload)
-rw-r--r-- | program/steps/mail/compose.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index de75c88d5..25cf63f70 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -978,6 +978,11 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml) { global $RCMAIL, $COMPOSE, $compose_mode; + $loaded_attachments = array(); + foreach ((array)$COMPOSE['attachments'] as $id => $attachment) { + $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment; + } + $cid_map = $messages = array(); foreach ((array)$message->mime_parts as $pid => $part) { @@ -1005,7 +1010,8 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml) } } - if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) { + if (!$skip && (($attachment = $loaded_attachments[rcmail_attachment_name($part) . $part->mimetype]) + || ($attachment = rcmail_save_attachment($message, $pid)))) { $COMPOSE['attachments'][$attachment['id']] = $attachment; if ($bodyIsHtml && ($part->content_id || $part->content_location)) { $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s', |