diff --git a/web/categories.go b/web/categories.go index 6e30b40..fc42444 100644 --- a/web/categories.go +++ b/web/categories.go @@ -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) }