Skip to content
Snippets Groups Projects
Commit 8b3e3717 authored by syuilo's avatar syuilo
Browse files

[API] Fix: Validate id

parent 225c89a5
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment