From 4dd9a5cc53226da73aa514eb6b7bfca5639f79cd Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 24 Mar 2014 19:12:04 -0500 Subject: [PATCH] Checking for no targets on PUT /groups/:id --- controllers/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/api.go b/controllers/api.go index 346aafe7..f5cd2842 100644 --- a/controllers/api.go +++ b/controllers/api.go @@ -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