Avoid loading already registered attachments when opening a draft message (on page reload)

pull/60/head
Thomas Bruederli 12 years ago
parent f0a7159c40
commit 5688d5baa2

@ -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',

Loading…
Cancel
Save