From 81c046c1b0b6a2a3c8cc820a387370f3f39c482a Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Wed, 30 Oct 2024 02:22:19 +0100 Subject: [PATCH] Add summary checks back --- cmd/frontend/articles.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/frontend/articles.go b/cmd/frontend/articles.go index 816480d..8819166 100644 --- a/cmd/frontend/articles.go +++ b/cmd/frontend/articles.go @@ -93,6 +93,10 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc { http.Error(w, "Bitte den Titel eingeben.", http.StatusBadRequest) return } + if len(article.Summary) == 0 { + http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest) + return + } article.ID, err = db.AddArticle(article) if err != nil { @@ -179,6 +183,10 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc { } summary := r.PostFormValue("article-summary") + if len(summary) == 0 { + http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest) + return + } content := r.PostFormValue("article-content") if len(content) == 0 {