Skip to content
Snippets Groups Projects
Commit 7c132765 authored by gbe's avatar gbe
Browse files

Enfore a maximum length on the name

parent f410ad46
No related branches found
No related tags found
No related merge requests found
......@@ -64,13 +64,17 @@ func main() {
// TODO: load/store image
// TODO: Validate max. length
name := r.FormValue("name")
if name == "" {
http.Error(w, "name empty or missing", http.StatusBadRequest)
return
}
if len(name) > 80 {
http.Error(w, "name too long, max length is 80", http.StatusBadRequest)
return
}
ratingVal := r.FormValue("rating")
rating, err := strconv.Atoi(ratingVal)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment