]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Mbox.pm
mbox: do not barf on queries which return no results
[public-inbox.git] / lib / PublicInbox / Mbox.pm
index 84cc384529f174cd020bbfb2360519720b5d0929..04c86cc196515e345d36491b200a1d29f3e4bd17 100644 (file)
@@ -157,7 +157,12 @@ sub response {
        # http://www.iana.org/assignments/media-types/application/gzip
        $body->{hdr} = [ 'Content-Type', 'application/gzip' ];
        $body->{fn} = $fn;
-       my $hdr = $body->getline; # fill in Content-Disposition filename
+       # fill in Content-Disposition filename
+       my $hdr = $body->getline;
+       if ($body->{hdr}) {
+               return [ 404, ['Content-Type','text/plain'],
+                       [ "No results found\n" ] ];
+       }
        [ 200, $hdr, $body ];
 }