Re: gitweb bug: broken "next" and other links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 11 Feb 2008, Jakub Narebski wrote:

> I'm sorry. You are right. I haven't seen breakage because it shows
> only when you use 'pathinfo' feature and pathinfo URLs.
> 
> Below there is a fix for that; actully only second part mentioned
> (and first in patch) is needed, i.e. moving setting $params{'project'}
> before dealing with -replay is needed I think to fix this bug.
> 
> Could you test it please?
> -->8 --
> From: Jakub Narebski <jnareb@xxxxxxxxx>
> Subject: [PATCH] gitweb: Fix bug in href(..., -replay=>1) when 'pathinfo' feature used
> 
> URLs generated by href(..., -replay=>1) (which includes 'next page'
> links and alternate view links) were not created correctly when using
> 'pathinfo' feature (i.e. using pathinfo instead of query string to
> denote project / git repository used).
> 
> This resulted in broken links such like:
>   http://www.example.com/w/ARRAY(0x85a5318)?a=shortlog;pg=1
> instead of:
>   http://www.example.com/w/project.git?a=shortlog;pg=1

Actually the error is there even without using 'pathinfo' feature,
namely if you use pathinfo to provide project, for example:
  http://www.example.com/w/project.git?a=shortlog
then 'next' link on the page lacks project (instead of having
dereferenced anonymous array reference, i.e. ARRAY(sth)), like below
  http://www.example.com/w/?a=shortlog;pg=1

But I could not come up with automated test which would _fail_
on this error. So please check, and reply if this patch helps.


Below there is hand-crafted minimal fixing patch.

> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 5e88637..648ee13 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -611,17 +611,17 @@ sub href(%) {
>  	);
>  	my %mapping = @mapping;
>  
> +	$params{'project'} = $project unless exists $params{'project'};
> +
>  	if ($params{-replay}) {
>  		while (my ($name, $symbol) = each %mapping) {
>  			if (!exists $params{$name}) {
>  				# to allow for multivalued params we use arrayref form
>  				$params{$name} = [ $cgi->param($symbol) ];
>  			}
>  		}
>  	}
>  
> -	$params{'project'} = $project unless exists $params{'project'};
> -
>  	my ($use_pathinfo) = gitweb_check_feature('pathinfo');
>  	if ($use_pathinfo) {
>  		# use PATH_INFO for project name
> -- 
> 1.5.4
> 
> 

-- 
Jakub Narebski
Poland
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux