about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-12 00:05:52 -0700
committerEric Wong <e@80x24.org>2021-02-12 22:58:31 -0400
commit376778b910cdf787d6e08cfd11acab26118899f4 (patch)
treefac5cc3de7cefa9629510917ca98bc4d9ac40758 /lib/PublicInbox
parent1138a7a940ec40ad4394aa55413456a6f6fd341e (diff)
downloadpublic-inbox-376778b910cdf787d6e08cfd11acab26118899f4.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/MboxReader.pm2
1 files changed, 1 insertions, 1 deletions
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);