]> Sergey Matveev's repositories - public-inbox.git/commitdiff
import: discard all the same headers as MDA
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Tue, 20 Mar 2018 19:50:03 +0000 (19:50 +0000)
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Tue, 20 Mar 2018 19:52:30 +0000 (19:52 +0000)
Reduce the places where we have duplicate logic for discarding
unwanted headers.

lib/PublicInbox/Import.pm
lib/PublicInbox/MDA.pm
lib/PublicInbox/WatchMaildir.pm

index fc740fa451c9d7ad19da99c1dc0a5490358674ae..e50f1156ca37380eaaa419d40599fb1fd347c0f6 100644 (file)
@@ -13,6 +13,7 @@ use PublicInbox::MID qw(mids mid_mime mid2path);
 use PublicInbox::Address;
 use PublicInbox::MsgTime qw(msg_timestamp);
 use PublicInbox::ContentId qw(content_digest);
+use PublicInbox::MDA;
 
 sub new {
        my ($class, $git, $name, $email, $ibx) = @_;
@@ -319,6 +320,7 @@ sub add {
 
        # kill potentially confusing/misleading headers
        $mime->header_set($_) for qw(bytes lines content-length status);
+       $mime->header_set($_) for @PublicInbox::MDA::BAD_HEADERS;
 
        # spam check:
        if ($check_cb) {
index d5af8f94081d3ab3f73d7403ca42f035e3f6b7de..637404eb2e553712b62df8db85ce7f159a56d73a 100644 (file)
@@ -81,8 +81,6 @@ sub set_list_headers {
                $pa =~ tr/@/./; # RFC2919
                $simple->header_set("List-Id", "<$pa>");
        }
-
-       $simple->header_set($_) foreach @BAD_HEADERS;
 }
 
 1;
index b165a6032000a091125bcecf31b24278306d744d..d3ca2a16d75e6a81df3422a60f467cc7203a5b90 100644 (file)
@@ -159,7 +159,6 @@ sub _try_path {
        }
        my $im = _importer_for($self, $inbox);
        my $mime = _path_to_mime($path) or return;
-       $mime->header_set($_) foreach @PublicInbox::MDA::BAD_HEADERS;
        my $wm = $inbox->{-watchheader};
        if ($wm) {
                my $v = $mime->header_obj->header_raw($wm->[0]);