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.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 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 AB3EE1F87F for ; Tue, 4 Jun 2019 11:27:48 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 02/24] nntp: be explicit about ASCII digit matches Date: Tue, 4 Jun 2019 11:27:26 +0000 Message-Id: <20190604112748.23598-3-e@80x24.org> In-Reply-To: <20190604112748.23598-1-e@80x24.org> References: <20190604112748.23598-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We aren't able to make sense of non-ASCII digits cf. perlrecharclass(1) / "Digits" section --- lib/PublicInbox/NNTP.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 8cb6c56..57300e8 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -437,7 +437,7 @@ sub set_nntp_headers ($$$$$) { # clobber some my $xref = xref($self, $ng, $n, $mid); $hdr->header_set('Xref', $xref); - $xref =~ s/:\d+//g; + $xref =~ s/:[0-9]+//g; $hdr->header_set('Newsgroups', (split(/ /, $xref, 2))[1]); header_append($hdr, 'List-Post', "{-primary_address}>"); if (my $url = $ng->base_url) { @@ -453,7 +453,7 @@ sub art_lookup ($$$) { my ($n, $mid); my $err; if (defined $art) { - if ($art =~ /\A\d+\z/o) { + if ($art =~ /\A[0-9]+\z/) { $err = '423 no such article number in this group'; $n = int($art); goto find_mid; @@ -508,7 +508,7 @@ sub simple_body_write ($$) { sub set_art { my ($self, $art) = @_; - $self->{article} = $art if defined $art && $art =~ /\A\d+\z/; + $self->{article} = $art if defined $art && $art =~ /\A[0-9]+\z/; } sub _header ($) { @@ -576,11 +576,11 @@ sub get_range ($$) { defined $range or return '420 No article(s) selected'; my ($beg, $end); my ($min, $max) = $ng->mm->minmax; - if ($range =~ /\A(\d+)\z/) { + if ($range =~ /\A([0-9]+)\z/) { $beg = $end = $1; - } elsif ($range =~ /\A(\d+)-\z/) { + } elsif ($range =~ /\A([0-9]+)-\z/) { ($beg, $end) = ($1, $max); - } elsif ($range =~ /\A(\d+)-(\d+)\z/) { + } elsif ($range =~ /\A([0-9]+)-([0-9]+)\z/) { ($beg, $end) = ($1, $2); } else { return r501; -- EW