]> Sergey Matveev's repositories - public-inbox.git/commitdiff
feed: only accept ASCII digits for ref~$N
authorEric Wong <e@80x24.org>
Tue, 4 Jun 2019 02:04:22 +0000 (02:04 +0000)
committerEric Wong <e@80x24.org>
Tue, 4 Jun 2019 10:06:18 +0000 (10:06 +0000)
We don't want to waste cycles passing non-ASCII characters
to git.

lib/PublicInbox/Feed.pm

index a04838a1a608948cbc096af61413337bd0f9444e..ae07189504327530290eb986bede736ae25c25cd 100644 (file)
@@ -102,7 +102,7 @@ sub recent_msgs {
        my $hex = '[a-f0-9]';
        my $addmsg = qr!^:000000 100644 \S+ (\S+) A\t${hex}{2}/${hex}{38}$!;
        my $delmsg = qr!^:100644 000000 (\S+) \S+ D\t(${hex}{2}/${hex}{38})$!;
-       my $refhex = qr/(?:HEAD|${hex}{4,40})(?:~\d+)?/;
+       my $refhex = qr/(?:HEAD|${hex}{4,40})(?:~[0-9]+)?/;
 
        # revision ranges may be specified
        my $range = 'HEAD';