1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-03-05 19:18:18 +00:00

Categories: Ignore empty hypha names and cat names in requests

This commit is contained in:
Timur Ismagilov 2022-03-29 19:46:29 +03:00
parent 3025aab445
commit 0446fc4794

View File

@ -47,6 +47,10 @@ func handlerRemoveFromCategory(w http.ResponseWriter, rq *http.Request) {
_, _ = io.WriteString(w, "403 Forbidden")
return
}
if hyphaName == "" || catName == "" {
http.Redirect(w, rq, redirectTo, http.StatusSeeOther)
return
}
categories.RemoveHyphaFromCategory(hyphaName, catName)
http.Redirect(w, rq, redirectTo, http.StatusSeeOther)
}
@ -63,6 +67,10 @@ func handlerAddToCategory(w http.ResponseWriter, rq *http.Request) {
_, _ = io.WriteString(w, "403 Forbidden")
return
}
if hyphaName == "" || catName == "" {
http.Redirect(w, rq, redirectTo, http.StatusSeeOther)
return
}
categories.AddHyphaToCategory(hyphaName, catName)
http.Redirect(w, rq, redirectTo, http.StatusSeeOther)
}