From: Junio C Hamano Date: Mon, 13 Jun 2011 16:47:59 GMT Subject: Re: [PATCH] gitweb: Make $prevent_xss protection for 'blob_plain' more usable Message-ID: <7v8vt5ptj4.fsf@alter.siamese.dyndns.org> In-Reply-To: <201106101401.19108.jnareb@gmail.com> Jakub Narebski 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"; Other than that, looks good to me. Thanks.