summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-20 07:56:33 +0000
committeralecpl <alec@alec.pl>2010-05-20 07:56:33 +0000
commit021ef41737e2ae328c8b5e428158d7aaddb1c117 (patch)
tree09fa7c6c27575e22461e9502e194a3e834a45d71
parentc1439f925dbfbd20566337a0251a6b4e85e9a2f9 (diff)
- Fix duplicated attachments when forwarding a message (#1486487)
-rw-r--r--CHANGELOG1
-rw-r--r--program/steps/mail/compose.inc16
2 files changed, 15 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 703898f69..909b8bb55 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Fix duplicated attachments when forwarding a message (#1486487)
- Fix message/rfc822 attachments containing only attachments are not parsed properly (#1486743)
- Fix %00 character in winmail.dat attachments names (#1486738)
- Fix handling errors of folder deletion (#1486705)
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 97541da91..50f11a361 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -738,13 +738,25 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml)
{
global $OUTPUT;
- $cid_map = array();
+ $cid_map = $messages = array();
foreach ((array)$message->mime_parts as $pid => $part)
{
if (($part->ctype_primary != 'message' || !$bodyIsHtml) && $part->ctype_primary != 'multipart' &&
($part->disposition == 'attachment' || ($part->disposition == 'inline' && $bodyIsHtml) || $part->filename))
{
- if ($attachment = rcmail_save_attachment($message, $pid)) {
+ $skip = false;
+ if ($part->mimetype == 'message/rfc822') {
+ $messages[] = $part->mime_id;
+ } else if ($messages) {
+ // skip attachments included in message/rfc822 attachment (#1486487)
+ foreach ($messages as $mimeid)
+ if (strpos($part->mime_id, $mimeid.'.') === 0) {
+ $skip = true;
+ break;
+ }
+ }
+
+ if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) {
$_SESSION['compose']['attachments'][$attachment['id']] = $attachment;
if ($bodyIsHtml && $part->content_id) {
$cid_map['cid:'.$part->content_id] = $OUTPUT->app->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'];