Jakub Narębski  committed 7863c61

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:;pg=1

if the 'pathinfo' feature was used, or;pg=1

if it wasn't, instead of correct:;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 <>
Noticed-by: Wincent Colaiuta <>
Signed-off-by: Jakub Narebski <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits ea14e6c

Comments (0)

Files changed (1)

File gitweb/gitweb.perl

 	my %mapping = @mapping;
+	$params{'project'} = $project unless exists $params{'project'};
 	if ($params{-replay}) {
 		while (my ($name, $symbol) = each %mapping) {
 			if (!exists $params{$name}) {
-	$params{'project'} = $project unless exists $params{'project'};
 	my ($use_pathinfo) = gitweb_check_feature('pathinfo');
 	if ($use_pathinfo) {
 		# use PATH_INFO for project name