From bc90b8ec27fda3b056a7493c76e0c3f00d090606 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Tue, 29 Jan 2019 12:12:10 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20plaintext=20attribute=20?= =?UTF-8?q?error=20when=20it=20is=20empty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs #10388 - Issue was caused by migration of empty strings to null https://github.com/TryGhost/Ghost/commit/0edacf3fc12c3d8598f4910c76fc90547c92ef0a --- .../api/v2/utils/serializers/output/utils/extra-attrs.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/server/api/v2/utils/serializers/output/utils/extra-attrs.js b/core/server/api/v2/utils/serializers/output/utils/extra-attrs.js index cfd5ad08ae..8f6fb7c1bf 100644 --- a/core/server/api/v2/utils/serializers/output/utils/extra-attrs.js +++ b/core/server/api/v2/utils/serializers/output/utils/extra-attrs.js @@ -5,7 +5,10 @@ module.exports.forPost = (frame, model, attrs) => { (frame.options.columns.includes('excerpt') && frame.options.formats && frame.options.formats.includes('plaintext'))) { if (_.isEmpty(attrs.custom_excerpt)) { const plaintext = model.get('plaintext'); - attrs.excerpt = plaintext.substring(0, 500); + + if (plaintext) { + attrs.excerpt = plaintext.substring(0, 500); + } } else { attrs.excerpt = attrs.custom_excerpt; }