Skip to content
Snippets Groups Projects
Commit 2f596948 authored by syuilo's avatar syuilo
Browse files

[API] Fix: Validate id

parent 46e85e5c
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,11 @@ module.exports = (params, me) =>
return rej('user_id or username is required');
}
// Validate id
if (userId && !mongo.ObjectID.isValid(userId)) {
return rej('incorrect user_id');
}
// Lookup user
const user = userId !== null
? await User.findOne({ _id: new mongo.ObjectID(userId) })
......
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