mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
[API] Fix: Validate id
This commit is contained in:
parent
1b499919b8
commit
8c747ab516
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user