Skip to content

Commit afa9b62

Browse files
jnarebgitster
authored andcommitted
gitweb: Fix bug in href(..., -replay=>1) when using 'pathinfo' form
URLs generated by href(..., -replay=>1) (which includes 'next page' links and alternate view links) didn't set project info correctly when current page URL is in pathinfo form. This resulted in broken links such like: http://www.example.com/w/ARRAY(0x85a5318)?a=shortlog;pg=1 if the 'pathinfo' feature was used, or http://www.example.com/w/?a=shortlog;pg=1 if it wasn't, instead of correct: http://www.example.com/w/project.git?a=shortlog;pg=1 This was caused by the fact that href() always replays params in the arrayref form, were they multivalued or singlevalued, and the code dealing with 'pathinfo' feature couldn't deal with $params{'project'} being arrayref. Setting $params{'project'} is moved before replaying params; this ensures that 'project' parameter is processed correctly. Noticed-by: Peter Oberndorfer <kumbayo84@arcor.de> Noticed-by: Wincent Colaiuta <win@wincent.com> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f019d08 commit afa9b62

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
@@ -611,6 +611,8 @@ (%)
611611
);
612612
my %mapping = @mapping;
613613

614+
$params{'project'} = $project unless exists $params{'project'};
615+
614616
if ($params{-replay}) {
615617
while (my ($name, $symbol) = each %mapping) {
616618
if (!exists $params{$name}) {
@@ -620,8 +622,6 @@ (%)
620622
}
621623
}
622624

623-
$params{'project'} = $project unless exists $params{'project'};
624-
625625
my ($use_pathinfo) = gitweb_check_feature('pathinfo');
626626
if ($use_pathinfo) {
627627
# use PATH_INFO for project name

0 commit comments

Comments
 (0)