about summary refs log tree commit homepage
path: root/lib/PublicInbox/MsgIter.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-05-16 10:03:22 +0000
committerEric Wong <e@yhbt.net>2020-05-17 06:56:40 +0000
commite60231148eb604a379033c69e8c4494eb1753783 (patch)
treec49950605f50bc46082e20ee7fe679c6cf76989e /lib/PublicInbox/MsgIter.pm
parent77aa1a9eae83fa60eb8208710a714aa4f39d9b34 (diff)
downloadpublic-inbox-e60231148eb604a379033c69e8c4494eb1753783.tar.gz
Email::MIME never supported this properly, but there's real
instances of forwarded messages as message/rfc822 attachments.
message/news is legacy thing which we'll see in archives, and
message/global appears to be the new thing.

gmime also supports message/rfc2822, so we'll support it anyways
despite lacking other evidence of its existence.

Existing attachments remain downloadable as a whole message,
but individual attachments of subparts are now downloadable
and can be displayed in HTML, too.

Furthermore, ensure Xapian can now search for common headers
inside those messages as well as the message bodies.
Diffstat (limited to 'lib/PublicInbox/MsgIter.pm')
-rw-r--r--lib/PublicInbox/MsgIter.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/MsgIter.pm b/lib/PublicInbox/MsgIter.pm
index 7c28d019..5ec2a4d9 100644
--- a/lib/PublicInbox/MsgIter.pm
+++ b/lib/PublicInbox/MsgIter.pm
@@ -64,8 +64,12 @@ sub msg_part_text ($$) {
         # times when it should not have been:
         #   <87llgalspt.fsf@free.fr>
         #   <200308111450.h7BEoOu20077@mail.osdl.org>
+        # But also do not try this with ->{is_submsg} (message/rfc822),
+        # since a broken multipart/mixed inside a message/rfc822 part
+        # has not been seen in the wild, yet...
         if ($err && ($ct =~ m!\btext/\b!i ||
-                        $ct =~ m!\bmultipart/mixed\b!i)) {
+                        (!$part->{is_submsg} &&
+                                $ct =~ m!\bmultipart/mixed\b!i) ) ) {
                 my $cte = $part->header_raw('Content-Transfer-Encoding');
                 if (defined($cte) && $cte =~ /\b7bit\b/i) {
                         $s = $part->body;