about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwListing.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-08-27 12:08:45 +0000
committerEric Wong <e@80x24.org>2021-08-28 10:37:10 +0000
commit733a7405f5a9d24782093876f178c6eb954dc17c (patch)
tree090a959b059f486f28dc78ac3b471a9d2ece6ed7 /lib/PublicInbox/WwwListing.pm
parentc08ecad116d24f642bb53634eb6243a54e3a20be (diff)
downloadpublic-inbox-733a7405f5a9d24782093876f178c6eb954dc17c.tar.gz
Searching inboxes with an empty query no longer gives 500 errors
due to Xapian.  Also, improve the error message when no inboxes
match, since saying no inboxes exist yet is wrong.
Diffstat (limited to 'lib/PublicInbox/WwwListing.pm')
-rw-r--r--lib/PublicInbox/WwwListing.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index eabda98a..1bb5fbd0 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -96,7 +96,8 @@ sub add_misc_ibx { # MiscSearch->retry_reopen callback
 
         delete $ctx->{-list}; # reset if retried
         my $pi_cfg = $ctx->{www}->{pi_cfg};
-        if (defined(my $user_query = $q->{'q'})) {
+        my $user_query = $q->{'q'} // '';
+        if ($user_query =~ /\S/) {
                 $qs = "( $qs ) AND ( $user_query )";
         } else { # special case for ALL
                 $ctx->ibx_entry($pi_cfg->ALL // die('BUG: ->ALL expected'), {});
@@ -218,6 +219,10 @@ sub psgi_triple {
                 $gzf->zmore('<pre>');
                 $gzf->zmore(join("\n", @$list));
                 $gzf->zmore(mset_footer($ctx, $mset)) if $mset;
+        } elsif (my $mset = delete $ctx->{-mset}) {
+                $gzf->zmore(mset_nav_top($ctx, $mset));
+                $gzf->zmore('<pre>no matching inboxes');
+                $gzf->zmore(mset_footer($ctx, $mset));
         } else {
                 $gzf->zmore('<pre>no inboxes, yet');
         }