From 376778b910cdf787d6e08cfd11acab26118899f4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 12 Feb 2021 00:05:52 -0700 Subject: mbox_reader: do not chomp non-blank EOL It's conceivable some cases won't generate an empty line before an mboxrd or mboxo From_ line. Ensure we can handle that case and don't leave the Eml->{bdy} without a trailing LF character. And drop an unnecessary alarm import while we're in the area. --- lib/PublicInbox/MboxReader.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/MboxReader.pm') diff --git a/lib/PublicInbox/MboxReader.pm b/lib/PublicInbox/MboxReader.pm index 59ce4fb6..df7c78fa 100644 --- a/lib/PublicInbox/MboxReader.pm +++ b/lib/PublicInbox/MboxReader.pm @@ -26,7 +26,7 @@ sub _mbox_from { } @raw = grep /[^ \t\r\n]/s, @raw; # skip empty messages while (defined(my $raw = shift @raw)) { - $raw =~ s/\r?\n\z//s; + $raw =~ s/^\r?\n\z//ms; $raw =~ s/$from_re/$1/gms; my $eml = PublicInbox::Eml->new(\$raw); $eml_cb->($eml, @arg); -- cgit v1.2.3-24-ge0c7