mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Have user avatar endpoint check that id is valid
To limit errors for client tests which send invalid ids
This commit is contained in:
parent
461fb14f37
commit
61953219a4
1 changed files with 2 additions and 0 deletions
|
@ -506,6 +506,8 @@ UserHandler = class UserHandler extends Handler
|
|||
hipchat.sendHipChatMessage "#{req.body.githubUsername or req.user.get('name')} just signed the CLA.", ['main']
|
||||
|
||||
avatar: (req, res, id) ->
|
||||
if not isID(id)
|
||||
return @sendBadInputError(res, 'Invalid avatar id')
|
||||
@modelClass.findById(id).exec (err, document) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
return @sendNotFoundError(res) unless document
|
||||
|
|
Loading…
Reference in a new issue