diff pkg/controllers/system.go @ 854:83c271cb2344

Reverted fcb38cedc680 (More tightened color model.) The get request did no longer work: HTTP/1.1 500 Internal Server Error Content-Type: text/plain; charset=utf-8 X-Content-Type-Options: nosniff Date: Fri, 28 Sep 2018 11:47:14 GMT Content-Length: 65 error: sql: Scan error on column index 3: Unexpected type string
author Sascha Wilde <wilde@intevation.de>
date Fri, 28 Sep 2018 13:54:57 +0200
parents fcb38cedc680
children a244b18cb916
line wrap: on
line diff
--- a/pkg/controllers/system.go	Fri Sep 28 13:45:04 2018 +0200
+++ b/pkg/controllers/system.go	Fri Sep 28 13:54:57 2018 +0200
@@ -111,6 +111,10 @@
 	attr := mux.Vars(req)["attr"]
 
 	c := input.(*models.Colour)
+	if !c.IsValid() {
+		err = JSONError{http.StatusBadRequest, "error: invalid colours"}
+		return
+	}
 
 	var res sql.Result
 	res, err = db.ExecContext(