about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-11 08:54:25 +0000
committerEric Wong <e@80x24.org>2015-01-11 08:57:03 +0000
commita33da0b97184a97a01d1f383bdb3faa24a7e648e (patch)
treee623c627aca2b9cab8aad948ea9d2ee1ea62ddfd
parent4438f547ecbb52d900dcc73fe4c03cb2e7d5562c (diff)
downloadpublic-inbox-a33da0b97184a97a01d1f383bdb3faa24a7e648e.tar.gz
Some mailers may omit the Content-Type header entirely,
so do detection and try to get the message through.
-rw-r--r--lib/PublicInbox/Filter.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/Filter.pm b/lib/PublicInbox/Filter.pm
index 929a8ffc..6862bb68 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