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 2F524201A7 for ; Fri, 12 May 2017 18:49:32 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] filter/subjecttag: account for missing Subject: header Date: Fri, 12 May 2017 18:49:32 +0000 Message-Id: <20170512184932.20738-1-e@80x24.org> List-Id: This is a high indicator of spam (but out-of-scope for this particular module) but sometimes it is not, and people legitimately forget to set a Subject: header at all. --- lib/PublicInbox/Filter/SubjectTag.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Filter/SubjectTag.pm b/lib/PublicInbox/Filter/SubjectTag.pm index 1d28142..7735a94 100644 --- a/lib/PublicInbox/Filter/SubjectTag.pm +++ b/lib/PublicInbox/Filter/SubjectTag.pm @@ -19,8 +19,10 @@ sub new { sub scrub { my ($self, $mime) = @_; my $subj = $mime->header('Subject'); - $subj =~ s/$self->{tag_re}/$1/; # $1 is "Re: " - $mime->header_str_set('Subject', $subj); + if (defined $subj) { + $subj =~ s/$self->{tag_re}/$1/; # $1 is "Re: " + $mime->header_str_set('Subject', $subj); + } $self->ACCEPT($mime); } -- EW