mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 17:23:09 +02:00
[API] Fix: Validate id
This commit is contained in:
parent
4ad04f5bfa
commit
1c9ec60140
1 changed files with 5 additions and 0 deletions
|
@ -25,6 +25,11 @@ module.exports = (params, user) =>
|
||||||
return rej('post_id is required');
|
return rej('post_id is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate id
|
||||||
|
if (!mongo.ObjectID.isValid(postId)) {
|
||||||
|
return rej('incorrect post_id');
|
||||||
|
}
|
||||||
|
|
||||||
// Get likee
|
// Get likee
|
||||||
const post = await Post.findOne({
|
const post = await Post.findOne({
|
||||||
_id: new mongo.ObjectID(postId)
|
_id: new mongo.ObjectID(postId)
|
||||||
|
|
Loading…
Reference in a new issue