about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-11 07:20:53 +0000
committerEric Wong <e@80x24.org>2023-10-11 22:10:48 +0000
commit770d8b3f465db89d80922c32d766b022cf4b31ed (patch)
tree3bd60df35645436d0aaac95227fa372b1e6f73a9 /lib/PublicInbox/NNTP.pm
parent3b7cdd9173bd0d74fc181b05c02d90b320d621ae (diff)
downloadpublic-inbox-770d8b3f465db89d80922c32d766b022cf4b31ed.tar.gz
Aside from our prior import bugs (fixed in a0c07cba0e5d8b6a
(mda: drop leading "From " lines again, 2016-06-26)), we'll
always have to be dealing with mutt piping messages to us and
`git format-patch' output.  So just share the regexp so we
can use it everywhere.

In may be desirable to allow importing messages with a leading
"From " line for FUSE, even.

Additionally, some instances of this regexp needlessly added
optional `\r?' (CR) checks ahead of the `\n' (LF) element; but
they're pointless anyways since [^\n]* is enough to exclude all
non-LF bytes.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 316b7775..603cf094 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -523,8 +523,7 @@ sub msg_hdr_write ($$) {
         set_nntp_headers($eml, $smsg);
 
         my $hdr = $eml->{hdr} // \(my $x = '');
-        # fixup old bug from import (pre-a0c07cba0e5d8b6a)
-        $$hdr =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+        PublicInbox::Eml::strip_from($$hdr);
         $$hdr =~ s/(?<!\r)\n/\r\n/sg; # Alpine barfs without this
 
         # for leafnode compatibility, we need to ensure Message-ID headers