summaryrefslogtreecommitdiff
path: root/roundcubemail/program
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-05-20 07:56:33 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-05-20 07:56:33 +0000
commit18a4127fff197c7c9c144c6f7ba600373f9373c0 (patch)
tree7215b2d3be347cc28b11585bd1eaf3bb827ff252 /roundcubemail/program
parented25df6dd32e653187381baba78f30927fc091c9 (diff)
- Fix duplicated attachments when forwarding a message (#1486487)
git-svn-id: https://svn.roundcube.net/trunk@3640 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
-rw-r--r--roundcubemail/program/steps/mail/compose.inc16
1 files changed, 14 insertions, 2 deletions
diff --git a/roundcubemail/program/steps/mail/compose.inc b/roundcubemail/program/steps/mail/compose.inc
index 97541da91..50f11a361 100644
--- a/roundcubemail/program/steps/mail/compose.inc
+++ b/roundcubemail/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'];