about summary refs log tree commit homepage
path: root/lib/PublicInbox/MboxReader.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-04 21:36:58 +0000
committerEric Wong <e@80x24.org>2021-09-04 23:33:06 +0000
commit09acfa0ba87514dac4802ca88b3c95bb53d15c04 (patch)
tree60c117b099564f06b54db089d698abbdc4aa6c41 /lib/PublicInbox/MboxReader.pm
parent42420897bd81bf5664d5a93c5069dda4cb0459f1 (diff)
downloadpublic-inbox-09acfa0ba87514dac4802ca88b3c95bb53d15c04.tar.gz
We may be handling invalid mboxes, so just return no objects in
that case.  While "lei q" on HTTP(S) externals expects a gzipped
mboxrd, there's always a chance something else gzipped can be
sent to us.

There's also changes to lei_to_mail to better handle emails
which lack a body and/or headers (e.g. t/solve/bare.patch)

Link: https://public-inbox.org/meta/20210903151500.h72mzcpqixgtytjs@meerkat.local/
Diffstat (limited to 'lib/PublicInbox/MboxReader.pm')
-rw-r--r--lib/PublicInbox/MboxReader.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/MboxReader.pm b/lib/PublicInbox/MboxReader.pm
index 9291f00b..5a754cb8 100644
--- a/lib/PublicInbox/MboxReader.pm
+++ b/lib/PublicInbox/MboxReader.pm
@@ -41,7 +41,7 @@ sub _mbox_from {
                         $raw =~ s/^\r?\n\z//ms;
                         $raw =~ s/$from_re/$1/gms;
                         my $eml = PublicInbox::Eml->new(\$raw);
-                        $eml_cb->($eml, @arg);
+                        $eml_cb->($eml, @arg) if $eml->raw_size;
                 }
                 return if $r == 0; # EOF
         }
@@ -96,6 +96,7 @@ sub _mbox_cl ($$$;@) {
                         $$hdr =~ s/\A[\r\n]*From [^\n]*\n//s or
                                 die "E: no 'From ' line in:\n", Dumper($hdr);
                         my $eml = PublicInbox::Eml->new($hdr);
+                        next unless $eml->raw_size;
                         my @cl = $eml->header_raw('Content-Length');
                         my $n = scalar(@cl);
                         $n == 0 and die "E: Content-Length missing in:\n",