]> 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 ead5c7d83ff4a07c5f796134026009e3af7185ed..04c86cc196515e345d36491b200a1d29f3e4bd17 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (C) 2015 all contributors <meta@public-inbox.org>
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Streaming interface for formatting messages as an mboxrd.
 # Used by the web interface
@@ -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 ];
 }