about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-02-09 00:43:02 +0000
committerEric Wong <e@80x24.org>2017-02-09 00:43:02 +0000
commitfb9ed5324ec7de9420956840ba9a6585b81e8231 (patch)
treeab6b34f8459a585205a25d1f3d18d31437b89052 /lib/PublicInbox/SearchIdx.pm
parent1ab8dabe04ebba61fd8761dca3d569947cbe20be (diff)
parentba4c50c20b95679580beba1ef290a4281d5285b7 (diff)
downloadpublic-inbox-fb9ed5324ec7de9420956840ba9a6585b81e8231.tar.gz
* origin/master:
  config: do not slurp lines into memory
  TODO: several updates
  search: schema version bump for empty References/In-Reply-To
  Revert "searchidx: reindex clobbers old thread IDs"
  searchidx: reindex clobbers old thread IDs
  searchidx: deal with empty In-Reply-To and References headers
  searchview: increase limit for displaying search results
  searchview: clarify numeric summary at bottom
  add filter for Subject: tags
  watchmaildir: allow arguments for filters
  watchmaildir: limit live importer processes
  learn: implement "rm" only functionality
  mime: avoid SUPER usage in Email::MIME subclass
  inbox: reinstate periodic cleanup of Xapian and SQLite objects
  introduce PublicInbox::MIME wrapper class
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r--lib/PublicInbox/SearchIdx.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 5adc17d3..c0ea3c1e 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -10,7 +10,7 @@ package PublicInbox::SearchIdx;
 use strict;
 use warnings;
 use Fcntl qw(:flock :DEFAULT);
-use Email::MIME;
+use PublicInbox::MIME;
 use Email::MIME::ContentType;
 $Email::MIME::ContentType::STRICT_PARAMS = 0;
 use base qw(PublicInbox::Search);
@@ -285,11 +285,15 @@ sub link_message {
         my $mime = $smsg->{mime};
         my $hdr = $mime->header_obj;
         my $refs = $hdr->header_raw('References');
-        my @refs = $refs ? ($refs =~ /<([^>]+)>/g) : ();
+        my @refs = defined $refs ? ($refs =~ /<([^>]+)>/g) : ();
         my $irt = $hdr->header_raw('In-Reply-To');
         if (defined $irt) {
-                $irt = mid_clean($irt);
-                $irt = undef if $mid eq $irt;
+                if ($irt eq '') {
+                        $irt = undef;
+                } else {
+                        $irt = mid_clean($irt);
+                        $irt = undef if $mid eq $irt;
+                }
         }
 
         my $tid;
@@ -393,7 +397,7 @@ sub do_cat_mail {
                 my $str = $git->cat_file($blob, $sizeref);
                 # fixup bugs from import:
                 $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
-                Email::MIME->new($str);
+                PublicInbox::MIME->new($str);
         };
         $@ ? undef : $mime;
 }