Re: gitweb not friendly to firefox revived

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

 



Hello,

> Nevertheless it shows what's the problem.  Somehow (perhaps wrong
> encoding, perhaps screw up with quoted-printable and git-am, perhaps
> copy'n' paste included ANSII color codes from terminal, perhaps something
> different altogether) you got control characters (\e = ESC) in $author.
> In strict XHTML mode (with 'application/xml
> 
> Please try the following patch
> 
> -- >8 --
> From: Jakub Narebski <jnareb@xxxxxxxxx>
> Subject: [PATCH] gitweb: Harden format_search_author()
> 
> Protect format_search_author against control characters in $author.
> While at it simplify it a bit, and use spaces for align.
> 
> Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx>
> ---
>  gitweb/gitweb.perl |   29 ++++++++++++++---------------
>  1 files changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 8b02767..ea9c09c 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1856,23 +1856,22 @@ sub format_search_author {
>  	my ($author, $searchtype, $displaytext) = @_;
>  	my $have_search = gitweb_check_feature('search');
>  
> -	if ($have_search) {
> -		my $performed = "";
> -		if ($searchtype eq 'author') {
> -			$performed = "authored";
> -		} elsif ($searchtype eq 'committer') {
> -			$performed = "committed";
> -		}
> -
> -		return $cgi->a({-href => href(action=>"search", hash=>$hash,
> -				searchtext=>$author,
> -				searchtype=>$searchtype), class=>"list",
> -				title=>"Search for commits $performed by $author"},
> -				$displaytext);
> +	return $displaytext unless ($have_search);
>  
> -	} else {
> -		return $displaytext;
> +	my $performed = "";
> +	if ($searchtype eq 'author') {
> +		$performed = "authored";
> +	} elsif ($searchtype eq 'committer') {
> +		$performed = "committed";
>  	}
> +
> +	my $title = to_utf8("Search for commits $performed by $author");
> +	$title =~ s/[[:cntrl:]]/?/g;
> +
> +	return $cgi->a({-href => href(action=>"search", hash=>$hash,
> +	                              searchtext=>$author, searchtype=>$searchtype),
> +	                -class=>"list", -title=>$title},
> +	               $displaytext);
>  }
Seems to do the right thing.  With Firefox I get a correct listing now
instead of the xml parse error.

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
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]