]> Sergey Matveev's repositories - public-inbox.git/commitdiff
import: allow messages without subject
authorEric Wong <e@80x24.org>
Sun, 19 Jun 2016 00:23:27 +0000 (00:23 +0000)
committerEric Wong <e@80x24.org>
Sun, 19 Jun 2016 00:23:27 +0000 (00:23 +0000)
Because our WatchMaildir module is liberal about what
it accepts, we can potentially have messages without a
subject.

lib/PublicInbox/Import.pm

index c13d4834992b57eb9c5dbcc81b356d84749d2753..5ffc26ef61760de872fd6a27b87ca1d89fc72500 100644 (file)
@@ -112,8 +112,11 @@ sub remove {
        defined($n) or die "read final byte of cat-blob failed: $!";
        die "bad read on final byte: <$lf>" if $lf ne "\n";
        my $cur = Email::MIME->new($buf);
-       if ($cur->header('Subject') ne $mime->header('Subject') ||
-                       norm_body($cur) ne norm_body($mime)) {
+       my $cur_s = $cur->header('Subject');
+       $cur_s = '' unless defined $cur_s;
+       my $cur_m = $mime->header('Subject');
+       $cur_m = '' unless defined $cur_m;
+       if ($cur_s ne $cur_m || norm_body($cur) ne norm_body($mime)) {
                return ('MISMATCH', $cur);
        }