From 5cdb54221fc8dd6b73333a2cf3e35e495c44d048 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 1 Sep 2018 09:47:25 +0200 Subject: [PATCH] Fix listing the same attachment multiple times on forwarded messages --- CHANGELOG | 1 + program/lib/Roundcube/rcube_message.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 517309858..f032e3185 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix listing the same attachment multiple times on forwarded messages - Fix compatibility with MySQL 8 - error on 'system' table use RELEASE 1.4-beta diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php index e6679649d..069942d6c 100644 --- a/program/lib/Roundcube/rcube_message.php +++ b/program/lib/Roundcube/rcube_message.php @@ -948,9 +948,11 @@ class rcube_message private function add_part($part, $type = null) { if ($this->check_context($part)) { + // It may happen that we add the same part to the array many times + // use part ID index to prevent from duplicates switch ($type) { - case 'inline': $this->inline_parts[] = $part; break; - case 'attachment': $this->attachments[] = $part; break; + case 'inline': $this->inline_parts[(string) $part->mime_id] = $part; break; + case 'attachment': $this->attachments[(string) $part->mime_id] = $part; break; default: $this->parts[] = $part; break; } }