mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Don't let content negotiator clobber the mime types of things other than HTML & XHTML
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70845 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3131b476a6
commit
65e3917fef
@ -174,6 +174,11 @@ class ContentNegotiator {
|
||||
* By default, negotiation is only enabled for pages that have the xml header.
|
||||
*/
|
||||
static function enabled_for($response) {
|
||||
$contentType = $response->getHeader("Content-Type");
|
||||
|
||||
// Disable content negotation for other content types
|
||||
if($contentType && substr($contentType, 0,9) != 'text/html' && substr($contentType, 0,21) != 'application/xhtml+xml') return false;
|
||||
|
||||
if(self::$enabled) return true;
|
||||
else return (substr($response->getBody(),0,5) == '<' . '?xml');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user