]> Sergey Matveev's repositories - public-inbox.git/commitdiff
feed: deal with removed files
authorEric Wong <e@80x24.org>
Thu, 28 Aug 2014 02:15:08 +0000 (02:15 +0000)
committerEric Wong <e@80x24.org>
Thu, 28 Aug 2014 02:47:11 +0000 (02:47 +0000)
Sometimes we get spam and need to delete messages,
we must prevent errors on missing messages from propagating.

lib/PublicInbox/Feed.pm

index 1eaba6c2c7362f7533dd09eb8906893dbfaaaf92..646c85c9977480498d592401d45327aa60643863 100644 (file)
@@ -291,8 +291,11 @@ sub dump_msg {
 
 sub do_cat_mail {
        my ($git, $path) = @_;
-       my $str = $git->cat_file("HEAD:$path");
-       Email::MIME->new($str);
+       my $mime = eval {
+               my $str = $git->cat_file("HEAD:$path");
+               Email::MIME->new($str);
+       };
+       $@ ? undef : $mime;
 }
 
 1;