about summary refs log tree commit homepage
path: root/lib/PublicInbox/Eml.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/Eml.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/Eml.pm')
-rw-r--r--lib/PublicInbox/Eml.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/PublicInbox/Eml.pm b/lib/PublicInbox/Eml.pm
index 955d6a96..0867a016 100644
--- a/lib/PublicInbox/Eml.pm
+++ b/lib/PublicInbox/Eml.pm
@@ -480,6 +480,14 @@ sub charset_set {
 
 sub crlf { $_[0]->{crlf} // "\n" }
 
+sub raw_size {
+        my ($self) = @_;
+        my $len = length(${$self->{hdr}});
+        defined($self->{bdy}) and
+                $len += length(${$self->{bdy}}) + length($self->{crlf});
+        $len;
+}
+
 # warnings to ignore when handling spam mailboxes and maybe other places
 sub warn_ignore {
         my $s = "@_";