[API] Fix bug

This commit is contained in:
syuilo 2017-03-01 14:49:04 +09:00
parent e407cca90b
commit 4f1a65f758

View file

@ -31,6 +31,10 @@ module.exports = (params, user) =>
// Get 'user_id' parameter // Get 'user_id' parameter
let recipient = params.user_id; let recipient = params.user_id;
if (recipient !== undefined && recipient !== null) { if (recipient !== undefined && recipient !== null) {
if (typeof recipient != 'string') {
return rej('user_id must be a string');
}
// Validate id // Validate id
if (!mongo.ObjectID.isValid(recipient)) { if (!mongo.ObjectID.isValid(recipient)) {
return rej('incorrect user_id'); return rej('incorrect user_id');