[API] Fix: Validate file_id

This commit is contained in:
syuilo 2017-02-12 06:01:31 +09:00
parent 330a57977e
commit ba14a1cb4a

View file

@ -26,6 +26,11 @@ module.exports = (params, user) =>
return rej('file_id is required');
}
// Validate id
if (!mongo.ObjectID.isValid(fileId)) {
return rej('incorrect file_id');
}
const file = await DriveFile
.findOne({
_id: new mongo.ObjectID(fileId),