Checking for no targets on PUT /groups/:id

pull/24/head
Jordan 2014-03-24 19:12:04 -05:00
parent ee6137e3e2
commit 4dd9a5cc53
1 changed files with 5 additions and 0 deletions

View File

@ -225,6 +225,11 @@ func API_Groups_Id(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Error: /:id and group_id mismatch", http.StatusBadRequest)
return
}
// Check to make sure targets were specified
if len(g.Targets) == 0 {
http.Error(w, "Error: No targets specified", http.StatusBadRequest)
return
}
err = db.PutGroup(&g, ctx.Get(r, "user_id").(int64))
if checkError(err, w, "Error updating group", http.StatusInternalServerError) {
return