From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, T_RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3C71A1F7B4; Sun, 11 Jan 2015 10:46:16 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH] filter: handle missing Content-Type Date: Sun, 11 Jan 2015 10:46:10 +0000 Message-Id: <1420973170-23779-1-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.2.0.35.g882592c List-Id: Some mailers may omit the Content-Type header entirely, so do detection and try to get the message through. --- lib/PublicInbox/Filter.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Filter.pm b/lib/PublicInbox/Filter.pm index 929a8ff..6862bb6 100644 --- a/lib/PublicInbox/Filter.pm +++ b/lib/PublicInbox/Filter.pm @@ -129,7 +129,7 @@ sub strip_multipart { return; } - my $part_type = $part->content_type; + my $part_type = $part->content_type || ''; if ($part_type =~ m!\btext/plain\b!i) { push @keep, $part; } elsif ($part_type =~ $MIME_HTML) { @@ -140,7 +140,8 @@ sub strip_multipart { # help with. push @keep, $part; - } elsif ($part_type =~ m!\Aapplication/octet-stream\z!i) { + } elsif ($part_type eq '' || + $part_type =~ m!\Aapplication/octet-stream\z!i) { # unfortunately, some mailers don't set correct types, # let messages of unknown type through but do not # change the sender-specified type -- EW