From 65e3917feffeb4523e0ba7b4fa4fd11c9d0329b3 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 28 Jan 2009 00:34:57 +0000 Subject: [PATCH] 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 --- core/control/ContentNegotiator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/control/ContentNegotiator.php b/core/control/ContentNegotiator.php index 52a606b9e..116bf59e8 100755 --- a/core/control/ContentNegotiator.php +++ b/core/control/ContentNegotiator.php @@ -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'); }