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:
Sam Minnee 2009-01-28 00:34:57 +00:00
parent 3131b476a6
commit 65e3917fef

View File

@ -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');
}