From 770d8b3f465db89d80922c32d766b022cf4b31ed Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 11 Oct 2023 07:20:53 +0000 Subject: treewide: consolidate "From " line removal 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. --- lib/PublicInbox/LeiInspect.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/LeiInspect.pm') diff --git a/lib/PublicInbox/LeiInspect.pm b/lib/PublicInbox/LeiInspect.pm index f801610f..65c64cf2 100644 --- a/lib/PublicInbox/LeiInspect.pm +++ b/lib/PublicInbox/LeiInspect.pm @@ -254,7 +254,7 @@ sub inspect_start ($$) { sub do_inspect { # lei->do_env cb my ($lei) = @_; my $str = delete $lei->{istr}; - $str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s; + PublicInbox::Eml::strip_from($str); my $eml = PublicInbox::Eml->new(\$str); inspect_start($lei, [ 'blob:'.$lei->git_oid($eml)->hexdigest, map { "mid:$_" } @{mids($eml)} ]); -- cgit v1.2.3-24-ge0c7