about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/SearchView.pm6
-rw-r--r--t/psgi_search.t6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index bf4415f0..219006a0 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -309,10 +309,8 @@ sub new {
         my ($class, $qp) = @_;
 
         my $r = $qp->{r};
-        my $l = $qp->{l} || '200';
-        if (! ($l =~ /(\d+)/ && $l <= $LIM)) {
-                $l = $LIM;
-        }
+        my ($l) = (($qp->{l} || '') =~ /(\d+)/);
+        $l = $LIM if !$l || $l > $LIM;
         bless {
                 q => $qp->{'q'},
                 x => $qp->{x} || '',
diff --git a/t/psgi_search.t b/t/psgi_search.t
index 1df38691..84b3daa3 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -64,6 +64,12 @@ test_psgi(sub { $www->call(@_) }, sub {
         is('%C3%86var', (keys %uniq)[0], 'matches original query');
         ok(index($html, 'by &#198;var Arnfj&#246;r&#240; Bjarmason') >= 0,
                 "displayed Ævar's name properly in HTML");
+
+        my $warn = [];
+        local $SIG{__WARN__} = sub { push @$warn, @_ };
+        $res = $cb->(GET('/test/?q=s:test&l=5e'));
+        is($res->code, 200, 'successful search result');
+        is_deeply([], $warn, 'no warnings from non-numeric comparison');
 });
 
 done_testing();