unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/4] import: allow messages without subject
Date: Sun, 19 Jun 2016 00:28:47 +0000	[thread overview]
Message-ID: <20160619002847.26685-5-e@80x24.org> (raw)
In-Reply-To: <20160619002847.26685-1-e@80x24.org>

Because our WatchMaildir module is liberal about what
it accepts, we can potentially have messages without a
subject.
---
 lib/PublicInbox/Import.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index c13d483..5ffc26e 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -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);
 	}
 

  parent reply	other threads:[~2016-06-19  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-19  0:28 [PATCH 0/4] watch improvements for mirroring Eric Wong
2016-06-19  0:28 ` [PATCH 1/4] emergency: avoid needless mkpath dependency Eric Wong
2016-06-19  0:28 ` [PATCH 2/4] watch_maildir: add scan test Eric Wong
2016-06-19  0:28 ` [PATCH 3/4] watch_maildir: spam removal support Eric Wong
2016-06-19  0:28 ` Eric Wong [this message]
2016-06-19  3:44 ` [PATCH 5/4] watch_maildir: tighten up path checks Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160619002847.26685-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).