about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-26 23:06:48 +0000
committerEric Wong <e@80x24.org>2016-06-26 23:06:48 +0000
commita0c07cba0e5d8b6a518e276e83477fd3892efaec (patch)
tree025c0d0b751f9ec741f0d305be3ffda7aafb7bc7 /script
parent10d076c7731c702e70950d06d673be163aa59be9 (diff)
downloadpublic-inbox-a0c07cba0e5d8b6a518e276e83477fd3892efaec.tar.gz
Oops...

While we're at it, drop blank lines before the "From ", too,
since it could happen.
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-learn2
-rwxr-xr-xscript/public-inbox-mda1
2 files changed, 2 insertions, 1 deletions
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index 7ef2a312..09fd7c8f 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 <STDIN>;
-        $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 f739ad06..d76f33a8 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 $/; <STDIN> };
+$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;