Skip to content

Commit 7833cdc

Browse files
In email display, don't suppress text in standalone multipart/related
With PreferRichText enabled, RT's transaction display suppressed a text/plain email part whose parent was multipart/related, on the assumption that the part was an alternative representation that would be superseded by a text/html sibling. When that root is text/plain, and no text/html part is present, RT rendered an empty transaction even though the content was available and visible via "View source". Unlike multipart/alternative, a standalone multipart/related is not an alternative container (RFC 2387). It has a single root part plus auxiliary parts the root references, so a text/plain part should not always be skipped. multipart/related was originally included in the alternative-handling in 4a38585 to fix "duplicate message" display for the common MUA structure: multipart/alternative text/plain # plain downgrade multipart/related text/html # composed rich body image/png # inline embedded image This commit retains that correct behavior, and now correctly displays the contents of other multipart/related email that does not follow the form above. Fixes: I#38197
1 parent 1b6597d commit 7833cdc

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

share/html/Elements/ShowTransactionAttachments

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,20 @@ my $render_attachment = sub {
220220
# it's a toplevel object
221221
!$ParentObj
222222

223-
# or its parent isn't a multipart alternative
224-
|| ( $ParentObj->ContentType !~ m{^multipart/(?:alternative|related)$}i )
223+
# or it isn't part of a multipart/alternative grouping. A
224+
# multipart/related is only an alternative representation when it
225+
# is itself nested inside a multipart/alternative (e.g. the rich
226+
# side of alternative -> [text/plain, related -> text/html]); a
227+
# standalone multipart/related is not an alternative container per
228+
# RFC 2387, so its root textual part must always be displayed.
229+
|| (
230+
$ParentObj->ContentType !~ m{^multipart/alternative$}i
231+
&& !(
232+
$ParentObj->ContentType =~ m{^multipart/related$}i
233+
&& $ParentObj->ParentObj
234+
&& $ParentObj->ParentObj->ContentType =~ m{^multipart/alternative$}i
235+
)
236+
)
225237

226238
# or it's of our prefered alterative type
227239
|| (

0 commit comments

Comments
 (0)