From 8de691d575742e67fe768a7cf4ec5f467e017d78 Mon Sep 17 00:00:00 2001 From: Katharina Irrgang Date: Fri, 13 Oct 2017 15:26:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20HTML=20page=20error:=20correct?= =?UTF-8?q?=20templateData=20(#9144)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - `this.statusCode` was always undefined - see HTML error handler - it's hard to add a test for this case - manual test only --- core/server/helpers/ghost_head.js | 1 + core/server/middleware/error-handler.js | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/server/helpers/ghost_head.js b/core/server/helpers/ghost_head.js index 8c7d7f5af4..d0570216f1 100644 --- a/core/server/helpers/ghost_head.js +++ b/core/server/helpers/ghost_head.js @@ -84,6 +84,7 @@ function getAjaxHelper(clientId, clientSecret) { module.exports = function ghost_head(options) { debug('begin'); + // if server error page do nothing if (this.statusCode >= 500) { return; diff --git a/core/server/middleware/error-handler.js b/core/server/middleware/error-handler.js index 8e8b956879..62eb0c47ea 100644 --- a/core/server/middleware/error-handler.js +++ b/core/server/middleware/error-handler.js @@ -81,11 +81,13 @@ _private.HTMLErrorRenderer = function HTMLErrorRender(err, req, res, next) { } var templateData = { - message: err.message, - code: err.statusCode, - errorDetails: err.errorDetails || [] - }, - template = templates.error(err.statusCode); + message: err.message, + // @deprecated + code: err.statusCode, + statusCode: err.statusCode, + errorDetails: err.errorDetails || [] + }, + template = templates.error(err.statusCode); // It can be that something went wrong with the theme or otherwise loading handlebars // This ensures that no matter what res.render will work here