Re: [PATCH] gitweb: Make $prevent_xss protection for 'blob_plain' more usable
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 13, 2011, 16:47 UTC
- Message-ID
- <7v8vt5ptj4.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <201106101401.19108.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 6 quoted lines
> + # 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.