]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/ContentId.pm
handle "multipart/mixed" messages which are not multipart
[public-inbox.git] / lib / PublicInbox / ContentId.pm
index b1d27eb8e48a8e835c0d088f77e84f3a7e38dd88..dd3155befefbd2d628683e6099847e72a34aec5a 100644 (file)
@@ -75,14 +75,7 @@ sub content_digest ($) {
                }
                $dig->add("b\0");
                my $ct = $part->content_type || 'text/plain';
-               my $s = eval { $part->body_str };
-               if ($@ && $ct =~ m!\btext/plain\b!i) {
-                       # Try to assume UTF-8 because Alpine
-                       # seems to do wacky things and set
-                       # charset=X-UNKNOWN
-                       $part->charset_set('UTF-8');
-                       $s = eval { $part->body_str };
-               }
+               my ($s, undef) = msg_part_text($part, $ct);
                if (defined $s) {
                        $s =~ s/\r\n/\n/gs;
                        $s =~ s/\s*\z//s;