Skip to content

Commit 7e00dc5

Browse files
jnarebgitster
authored andcommitted
gitweb: Fix bug in evaluate_path_info
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ae5e97e commit 7e00dc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitweb/gitweb.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,10 +780,10 @@ sub evaluate_path_info {
780780
'history',
781781
);
782782

783-
# we want to catch
783+
# we want to catch, among others
784784
# [$hash_parent_base[:$file_parent]..]$hash_parent[:$file_name]
785785
my ($parentrefname, $parentpathname, $refname, $pathname) =
786-
($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?(.+?)(?::(.+))?$/);
786+
($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?([^:]+?)?(?::(.+))?$/);
787787

788788
# first, analyze the 'current' part
789789
if (defined $pathname) {

0 commit comments

Comments
 (0)