From e60231148eb604a379033c69e8c4494eb1753783 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 16 May 2020 10:03:22 +0000 Subject: descend into message/(rfc822|news|global) parts 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. --- lib/PublicInbox/MsgIter.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/MsgIter.pm') 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; -- cgit v1.2.3-24-ge0c7