Fixed the latest version handler to handle invalid original id inputs.

This commit is contained in:
Scott Erickson 2014-11-29 11:11:40 -08:00
parent 42c7fca055
commit 3e0394d0d8

View file

@ -298,6 +298,8 @@ module.exports = class Handler
getLatestVersion: (req, res, original, version) ->
# can get latest overall version, latest of a major version, or a specific version
return @sendBadInputError(res, 'Invalid MongoDB id: '+original) if not Handler.isID(original)
query = { 'original': mongoose.Types.ObjectId(original) }
if version?
version = version.split('.')