mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'jn/mime-type-with-params' into maint
* jn/mime-type-with-params: gitweb: Serve */*+xml 'blob_plain' as text/plain with $prevent_xss gitweb: Serve text/* 'blob_plain' as text/plain with $prevent_xss
This commit is contained in:
commit
5329c99795
|
@ -6129,7 +6129,16 @@ sub git_blob_plain {
|
||||||
# want to be sure not to break that by serving the image as an
|
# want to be sure not to break that by serving the image as an
|
||||||
# attachment (though Firefox 3 doesn't seem to care).
|
# attachment (though Firefox 3 doesn't seem to care).
|
||||||
my $sandbox = $prevent_xss &&
|
my $sandbox = $prevent_xss &&
|
||||||
$type !~ m!^(?:text/plain|image/(?:gif|png|jpeg))(?:[ ;]|$)!;
|
$type !~ m!^(?:text/[a-z]+|image/(?:gif|png|jpeg))(?:[ ;]|$)!;
|
||||||
|
|
||||||
|
# serve text/* as text/plain
|
||||||
|
if ($prevent_xss &&
|
||||||
|
($type =~ m!^text/[a-z]+\b(.*)$! ||
|
||||||
|
($type =~ m!^[a-z]+/[a-z]\+xml\b(.*)$! && -T $fd))) {
|
||||||
|
my $rest = $1;
|
||||||
|
$rest = defined $rest ? $rest : '';
|
||||||
|
$type = "text/plain$rest";
|
||||||
|
}
|
||||||
|
|
||||||
print $cgi->header(
|
print $cgi->header(
|
||||||
-type => $type,
|
-type => $type,
|
||||||
|
|
Loading…
Reference in a new issue