Skip to content

Commit

Permalink
Merge pull request #189 from davellanedam/revert-168-patch-2
Browse files Browse the repository at this point in the history
Revert "Update utils.js"
  • Loading branch information
davellanedam authored Jan 12, 2020
2 parents 49c6aaa + 12a93b5 commit 253d29b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/middleware/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const mongoose = require('mongoose')
const requestIp = require('request-ip')
const { validationResult } = require('express-validator')

Expand Down Expand Up @@ -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'))
Expand Down

0 comments on commit 253d29b

Please sign in to comment.