]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Fix bug in evaluate_path_info
authorJakub Narebski <redacted>
Wed, 13 Oct 2010 11:33:48 +0000 (13:33 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:30 +0000 (00:51 -0400)
There was bug in parsing "project/:/file" and "project/:/" path_info
URLs, with implicit HEAD as 'hash_base'.

For such URLs the refname is empty, and before this fix regexp for
parsing path_info fragment assumed that it is always non-empty.

Refname cannot contain ':', as per 'git check-ref-format'.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index b8b5aa4a4f47d66629c208e31058cdb3e4f376bd475e3b8d2b1a005275ef2042..df186d8d2a107ef28ad8ca7e3724963b6519db39b4c90d64b416d9a23508d1a5 100755 (executable)
@@ -782,10 +782,10 @@ sub evaluate_path_info {
                'history',
        );
 
-       # we want to catch
+       # we want to catch, among others
        # [$hash_parent_base[:$file_parent]..]$hash_parent[:$file_name]
        my ($parentrefname, $parentpathname, $refname, $pathname) =
-               ($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?(.+?)(?::(.+))?$/);
+               ($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?([^:]+?)?(?::(.+))?$/);
 
        # first, analyze the 'current' part
        if (defined $pathname) {
This page took 0.273572 seconds and 4 git commands to generate.