diff --git a/README.md b/README.md index 98292c5..c4c2987 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ * [Pilwon Huh](https://github.com/pilwon) (creator, maintainer) * [Brian Park](https://github.com/yaru22) (collaborator) + * [Adrian Maurer](https://github.com/VerticodeLabs) (contributor) Thanks to [all the other contributors](https://github.com/pilwon/node-ultimate/graphs/contributors) as well! :) diff --git a/lib/server/route/restify.js b/lib/server/route/restify.js index 160217b..0d1145a 100644 --- a/lib/server/route/restify.js +++ b/lib/server/route/restify.js @@ -326,8 +326,10 @@ Restify.prototype._buildController = function (verb, Model, fields) { function _buildFindQuery(req, id) { var condition = { $or: [] }; - if (id.match(/^[0-9a-fA-F]{24}$/)) { + if (id.match(/^[0-9]{4}[0-9a-fA-F]{20}$/)) { condition.$or.push({ _id: id }); + } else if (id.match(/^[a-z][-a-z0-9]*$/)) { // slug (objectId always starts a 4-byte value representing the seconds since the Unix epoch) + condition.$or.push({ slug: id }); } else { condition.$or.push({ uid: id }); }