lib/PublicInbox/WwwListing.pm | 7 ++++++- t/extindex-psgi.t | 10 ++++++++-- diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm index eabda98abe484bebc0ff41276de648e91675f8bc..1bb5fbd041587cbc3931d370fcecde9519d5ff6e 100644 --- a/lib/PublicInbox/WwwListing.pm +++ b/lib/PublicInbox/WwwListing.pm @@ -96,7 +96,8 @@ $qs .= ' type:inbox'; 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 @@ } $gzf->zmore('
');
 		$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('
no matching inboxes');
+		$gzf->zmore(mset_footer($ctx, $mset));
 	} else {
 		$gzf->zmore('
no inboxes, yet');
 	}
diff --git a/t/extindex-psgi.t b/t/extindex-psgi.t
index 31b04acd40cebfad4003d73bbd47141b6e98f6be..4e26962e06c923b4b31901933eed61854bf3d07d 100644
--- a/t/extindex-psgi.t
+++ b/t/extindex-psgi.t
@@ -59,8 +59,14 @@ 	$res = $cb->(GET('/all/all.mbox.gz'));
 	is($res->code, 200, 'all.mbox.gz');
 
 	$res = $cb->(GET('/'));
-	my $html = $res->content;
-	like($html, qr!\Qhttp://bogus.example.com/all\E!, 'html shows /all');
+	like($res->content, qr!\Qhttp://bogus.example.com/all\E!,
+		'/all listed');
+	$res = $cb->(GET('/?q='));
+	is($res->code, 200, 'no query means all inboxes');
+	$res = $cb->(GET('/?q=nonexistent'));
+	is($res->code, 404, 'no inboxes matched');
+	unlike($res->content, qr!no inboxes, yet!,
+		'we have inboxes, just no matches');
 };
 test_psgi(sub { $www->call(@_) }, $client);
 %$env = (%$env, TMPDIR => $tmpdir, PI_CONFIG => $pi_config);