Subject: Re: [PATCH] gitweb: Make $prevent_xss protection for 'blob_plain' more usable

From: Jakub Narebski <[email-masked]>
Date: Mon, 13 Jun 2011 23:49:59 +0200

Junio C Hamano wrote:
> Jakub Narebski <[email-masked]> writes:
> 
> > +	# serve text/* as text/plain
> > +	if ($prevent_xss &&
> > +	    $type =~ m!^text/([a-z]+)\b(.*)$!) {
> > +		my ($subtype, $rest) = ($1, $2);
> > +		$rest = defined $rest ? $rest : '';
> > +		$type = "text/plain$rest" if ($subtype ne 'plain');
> 
> Hmph, wouldn't it be more straightforward if you dropped the statement
> modifier?  I.e.
> 
> 	my ($subtype, $rest) = ($1, $2);
> 	$rest = '' unless defined $rest;
> 	$type = "text/plain$rest";

Yes, of course.

I don't know why I decided that avoiding rewriting 'text/plain; 
charset=utf-8' case was important.  It cretainly is not worth making 
code harder to follow.
 
Can you fix it during applying, or should I resend it?

> Other than that, looks good to me.

Thanks.
-- 
Jakub Narebski
Poland