fix post export crashing if a pid reference doesn't resolve to an actual post object

v1.18.x
Julian Lam 7 years ago
parent 01daf4b662
commit be1a977c71

@ -117,8 +117,8 @@ userController.exportPosts = function (req, res, next) {
return next(err); return next(err);
} }
// Convert newlines in content // Remove empty post references and convert newlines in content
posts = posts.map(function (post) { posts = posts.filter(Boolean).map(function (post) {
post.content = '"' + post.content.replace(/\n/g, '\\n').replace(/"/g, '\\"') + '"'; post.content = '"' + post.content.replace(/\n/g, '\\n').replace(/"/g, '\\"') + '"';
return post; return post;
}); });

Loading…
Cancel
Save