[Rt-commit] rt branch, 4.4/top-multipart-related-attachments, created. rt-4.4.2-105-g85a67f6fd
? sunnavy
sunnavy at bestpractical.com
Thu Apr 5 08:26:02 EDT 2018
The branch, 4.4/top-multipart-related-attachments has been created
at 85a67f6fd095cc25bf60f8b85fe1d37e4d7cd07e (commit)
- Log -----------------------------------------------------------------
commit 85a67f6fd095cc25bf60f8b85fe1d37e4d7cd07e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Apr 5 19:37:42 2018 +0800
Hide texts in multipart/related only if it has a perferred alternative
In 4a38585f, we added code to handle the following structure:
multipart/alternative
text/plain
multipart/related
text/html
image/png
That commit treats "multipart/related" as "multipart/alternative",
assuming "multipart/related" is always under "multiplart/alternative",
which is sadly not always correct, recently we encountered an email with
a structure like:
multipart/related
text/plain
image/png
It doesn't have a corresponding "text/html" alternative, so if user
prefers rich text, only the "image/png" shows up on ticket display page.
This commit fixes it by checking if "multipart/related" is really under
"multiplart/alternative".
diff --git a/share/html/Elements/ShowTransactionAttachments b/share/html/Elements/ShowTransactionAttachments
index e282de9d4..9296e7aac 100644
--- a/share/html/Elements/ShowTransactionAttachments
+++ b/share/html/Elements/ShowTransactionAttachments
@@ -165,7 +165,8 @@ my $render_attachment = sub {
!$ParentObj
# or its parent isn't a multipart alternative
- || ( $ParentObj->ContentType !~ m{^multipart/(?:alternative|related)$}i )
+ || ( $ParentObj->ContentType !~ m{^multipart/alternative$}i )
+ || ( $ParentObj->ContentType =~ m{^multipart/related$}i && !( $ParentObj->Parent && $ParentObj->ParentObj->ContentType =~ m{^multipart/alternative$}i ) )
# or it's of our prefered alterative type
|| (
-----------------------------------------------------------------------
More information about the rt-commit
mailing list