mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
🐛 Fixed error handling for html response (#9280)
refs https://github.com/TryGhost/Team/issues/41 - if you add invalid handlebars logic e.g. {{if condition condition}}, handlebars throws an error - in case of having invalid hbs in an amp page, the amp component throwed another syntax error (which is fixed in this PR) - furthermore the `setTemplate` helper function had a logic bug, which did not handle errors correctly - if there is an error and a template is set (e.g. amp), we have to still render the error page and not the amp page - this fix only ensures that the error handling is correct, we still see the error of the "ugly" handlebars message - e.g. [amp.hbs] Cannot read property 'includeZero' of undefined - but no longer -> Cannot read property 'html' of undefined (which was a syntax error in Ghost)
This commit is contained in:
parent
3004e03bc6
commit
d87fbeca49
2 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ var proxy = require('../../../../helpers/proxy'),
|
|||
|
||||
function ampComponents() {
|
||||
var components = [],
|
||||
html = this.post.html || this.html;
|
||||
html = this.post && this.post.html || this.html;
|
||||
|
||||
if (!html) {
|
||||
return;
|
||||
|
|
|
@ -143,7 +143,7 @@ _private.getTemplateForError = function getTemplateForError(statusCode) {
|
|||
module.exports.setTemplate = function setTemplate(req, res, data) {
|
||||
var routeConfig = res._route || {};
|
||||
|
||||
if (res._template) {
|
||||
if (res._template && !req.err) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue