From 12a93b550c71c882be029aa2b7be7bb551e8513f Mon Sep 17 00:00:00 2001 From: Daniel Avellaneda Date: Sun, 12 Jan 2020 16:19:32 -0500 Subject: [PATCH] Revert "Update utils.js" --- app/middleware/utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/middleware/utils.js b/app/middleware/utils.js index de47165..85997f7 100644 --- a/app/middleware/utils.js +++ b/app/middleware/utils.js @@ -1,4 +1,3 @@ -const mongoose = require('mongoose') const requestIp = require('request-ip') const { validationResult } = require('express-validator') @@ -97,7 +96,7 @@ exports.buildSuccObject = message => { */ exports.isIDGood = async id => { return new Promise((resolve, reject) => { - const goodID = mongoose.Types.ObjectId.isValid(id) + const goodID = String(id).match(/^[0-9a-fA-F]{24}$/) return goodID ? resolve(id) : reject(this.buildErrObject(422, 'ID_MALFORMED'))