1
0
forked from mirror/misskey

[API] Fix: Validate id

This commit is contained in:
syuilo 2017-01-21 07:46:43 +09:00
parent 225c89a5b8
commit 8b3e371733

View File

@ -23,6 +23,11 @@ module.exports = (params, user) =>
return rej('post_id is required');
}
// Validate id
if (!mongo.ObjectID.isValid(postId)) {
return rej('incorrect post_id');
}
// Get post
const post = await Post.findOne({
_id: new mongo.ObjectID(postId)