about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-22 07:54:01 +0000
committerEric Wong <e@80x24.org>2021-03-23 00:07:14 +0000
commitbbf3bbfe8e45fb79e2b848966aac5792268b3d8f (patch)
treebbf5fb59241358b996aa7ca970cf182c1c9fad0f /lib
parent60e5bddd086a8a90d5eaff32bc5c2026fc784ca0 (diff)
downloadpublic-inbox-bbf3bbfe8e45fb79e2b848966aac5792268b3d8f.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LeiInput.pm4
1 files changed, 4 insertions, 0 deletions
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