]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
Revert "searchidx: reindex clobbers old thread IDs"
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index 87ee0d46406ef688aa215356143923a82ddd9b14..1142ca7a0f4c83a6aa4103edc79d91bd04944e5a 100644 (file)
@@ -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);
@@ -292,11 +292,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;
@@ -400,7 +404,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;
 }