mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
fix: crash in export posts if post content is undefined
This commit is contained in:
@@ -91,7 +91,7 @@ userController.exportPosts = async function (req, res) {
|
|||||||
let postData = await posts.getPostsData(pids);
|
let postData = await posts.getPostsData(pids);
|
||||||
// Remove empty post references and convert newlines in content
|
// Remove empty post references and convert newlines in content
|
||||||
postData = postData.filter(Boolean).map(function (post) {
|
postData = postData.filter(Boolean).map(function (post) {
|
||||||
post.content = '"' + post.content.replace(/\n/g, '\\n').replace(/"/g, '\\"') + '"';
|
post.content = '"' + String(post.content || '').replace(/\n/g, '\\n').replace(/"/g, '\\"') + '"';
|
||||||
return post;
|
return post;
|
||||||
});
|
});
|
||||||
payload = payload.concat(postData);
|
payload = payload.concat(postData);
|
||||||
|
|||||||
Reference in New Issue
Block a user