From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D62D720179 for ; Sun, 26 Jun 2016 23:31:31 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] mda: drop leading "From " lines again Date: Sun, 26 Jun 2016 23:31:31 +0000 Message-Id: <20160626233131.7531-1-e@80x24.org> List-Id: Oops... While we're at it, drop blank lines before the "From ", too, since it could happen. --- script/public-inbox-learn | 2 +- script/public-inbox-mda | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/script/public-inbox-learn b/script/public-inbox-learn index 7ef2a31..09fd7c8 100755 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -26,7 +26,7 @@ my $err; my $mime = Email::MIME->new(eval { local $/; my $data = scalar ; - $data =~ s/\AFrom [^\r\n]*\r?\n//s; + $data =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s; eval { if ($train eq 'ham') { $spamc->hamlearn(\$data); diff --git a/script/public-inbox-mda b/script/public-inbox-mda index f739ad0..d76f33a 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -32,6 +32,7 @@ use PublicInbox::Spamcheck::Spamc; my $emergency = $ENV{PI_EMERGENCY} || "$ENV{HOME}/.public-inbox/emergency/"; $ems = PublicInbox::Emergency->new($emergency); my $str = eval { local $/; }; +$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s; $ems->prepare(\$str); my $simple = Email::Simple->new(\$str); my $config = PublicInbox::Config->new;