diff options
author | Eric Wong <e@80x24.org> | 2016-05-12 09:06:28 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-12 09:06:28 +0000 |
commit | 1f89e15a29cd63335f40902f1de7944e2efe91fa (patch) | |
tree | b5b0caf0a5181b0c842552bb1e85bdf02420e2b1 /lib | |
parent | c549ac50c2e7be9345decb170374485d8b1fc04c (diff) | |
download | public-inbox-1f89e15a29cd63335f40902f1de7944e2efe91fa.tar.gz |
Mbox formatters may add extra newlines at the end of the message, and that's not relevant for comparing messages for deletion.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Import.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 5a3c5851..1f52a0cc 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -65,6 +65,13 @@ sub now2822 () { $day, $t[3], $mon, $t[5] + 1900, $t[2], $t[1], $t[0]); } +sub norm_body ($) { + my ($mime) = @_; + my $b = $mime->body_raw; + $b =~ s/(\r?\n)+\z//s; + $b +} + # returns undef on non-existent # ('MISMATCH', msg) on mismatch # (:MARK, msg) on success @@ -106,7 +113,7 @@ sub remove { 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') || - $cur->body ne $mime->body) { + norm_body($cur) ne norm_body($mime)) { return ('MISMATCH', $cur); } |