From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 946C81F61A for ; Wed, 14 Dec 2022 22:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1671056648; bh=QMojiAIorv04lERhU8zqk86ACvwXaRpVn/dA6IDAfYA=; h=From:To:Subject:Date:From; b=O39/Cs2LZtX6VkyZI/OmTzU2BVhehRBCSkT3uMxOAlasidI+mIzk5FP8clZG5MhJH mHa2rs/3vcShp76xyO6LhIvRWkd+m3CEKtArkO1+vltHMtpXf+2nFM1ZZowPtGI0zq FE+2NzchWqyClIywXiBk3/zrJdma//4TUUOccAwU= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] search_query: fix warnings on empty "o=" query Date: Wed, 14 Dec 2022 22:24:08 +0000 Message-Id: <20221214222408.560-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This fixes the following warnings from bad URLs: Odd number of elements in anonymous hash at <>/PublicInbox/SearchQuery.pm line 22. Argument "l" isn't numeric in numeric lt (<) at <>/PublicInbox/SearchView.pm line 39. --- lib/PublicInbox/SearchQuery.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/SearchQuery.pm b/lib/PublicInbox/SearchQuery.pm index a6b7d843..96246c53 100644 --- a/lib/PublicInbox/SearchQuery.pm +++ b/lib/PublicInbox/SearchQuery.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # used by PublicInbox::SearchView and PublicInbox::WwwListing @@ -16,10 +16,11 @@ sub new { my $t = $qp->{t}; # collapse threads my ($l) = (($qp->{l} || '') =~ /([0-9]+)/); $l = $LIM if !$l || $l > $LIM; + my ($o) = (($qp->{o} || '0') =~ /(-?[0-9]+)/); bless { q => $qp->{'q'}, x => $qp->{x} || '', - o => (($qp->{o} || '0') =~ /(-?[0-9]+)/), + o => $o, l => $l, r => (defined $r && $r ne '0'), t => (defined $t && $t ne '0'),