FIX text/html type for Debug::friendlyError() in live mode

Avoid unparsed HTML responses in case of httpError(4xx) or
httpError(5xx) in live mode. The SS_HTTPResponse_Exception constructor
automatically set "text/plain" a content type, which conflicts
with the later choice of Debug::friendlyError() to return HTML.

This is a hotfix, needs more work to properly separate
logic flow from presentation concerns (e.g. through request processors).
This commit is contained in:
Ingo Schommer 2013-11-18 16:02:12 +01:00
parent bd5fdf1f19
commit a0dbfc61b6

View File

@ -347,6 +347,7 @@ class Debug {
);
if(file_exists($errorFilePath)) {
$content = file_get_contents(ASSETS_PATH . "/error-$statusCode.html");
if(!headers_sent()) header('Content-Type: text/html');
// $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
echo str_replace('$BaseURL', Director::absoluteBaseURL(), $content);
}