mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
fix post export crashing if a pid reference doesn't resolve to an actual post object
This commit is contained in:
@@ -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;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user