From 8097083ed69ac1b8986df8adbdca575ea2165c63 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Mar 2017 14:49:04 +0900 Subject: [PATCH] [API] Fix bug --- src/api/endpoints/messaging/messages/create.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/endpoints/messaging/messages/create.js b/src/api/endpoints/messaging/messages/create.js index 47bc1a996..2d52bf263 100644 --- a/src/api/endpoints/messaging/messages/create.js +++ b/src/api/endpoints/messaging/messages/create.js @@ -31,6 +31,10 @@ module.exports = (params, user) => // Get 'user_id' parameter let recipient = params.user_id; if (recipient !== undefined && recipient !== null) { + if (typeof recipient != 'string') { + return rej('user_id must be a string'); + } + // Validate id if (!mongo.ObjectID.isValid(recipient)) { return rej('incorrect user_id');