From bbf3bbfe8e45fb79e2b848966aac5792268b3d8f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 22 Mar 2021 07:54:01 +0000 Subject: lei_input: drop "From " line on single "eml" (message/rfc822) This matches the long-standing behavior of public-inbox-mda, public-inbox-learn and our other tools. It is useful because mutt, "git format-patch", and likely other tools will pipe a single message with a "From " header line, but with no further "From " escaping or Content-Length: header. --- lib/PublicInbox/LeiInput.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm index c62b0893..859fdb11 100644 --- a/lib/PublicInbox/LeiInput.pm +++ b/lib/PublicInbox/LeiInput.pm @@ -32,6 +32,10 @@ sub input_fh { return $self->{lei}->child_error(1 << 8, <<""); error reading $name: $! + # mutt pipes single RFC822 messages with a "From " line, + # but no Content-Length or "From " escaping. + # "git format-patch" also generates such files by default. + $buf =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s; $self->eml_cb(PublicInbox::Eml->new(\$buf), @args); } else { # prepare_inputs already validated $ifmt -- cgit v1.2.3-24-ge0c7