]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/MsgIter.pm
update copyrights for 2021
[public-inbox.git] / lib / PublicInbox / MsgIter.pm
index 7c28d019abc8c7e9fae81c9db2b0196c21e81310..c503eb98b8c502e3ecda265007772fada888424f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # read-only utilities for Email::MIME
@@ -34,7 +34,7 @@ sub em_each_part ($$;$$) {
                        }
                }
        } else {
-               $cb->([$mime, 0, 0], $cb_arg);
+               $cb->([$mime, 0, 1], $cb_arg);
        }
 }
 
@@ -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;