Fix bug that allowed empty banner images
This commit is contained in:
parent
083718711d
commit
e95871ee70
@ -80,7 +80,7 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
||||
|
||||
article := &b.Article{
|
||||
Title: r.PostFormValue("article-title"),
|
||||
BannerLink: c.Domain + "/image/serve/" + r.PostFormValue("article-banner-url"),
|
||||
BannerLink: r.PostFormValue("article-banner-url"),
|
||||
Summary: r.PostFormValue("article-summary"),
|
||||
Published: false,
|
||||
Rejected: false,
|
||||
@ -93,10 +93,13 @@ 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.BannerLink) == 0 {
|
||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
article.BannerLink = c.Domain + "/image/serve/" + article.BannerLink
|
||||
|
||||
if len(article.Summary) == 0 {
|
||||
http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest)
|
||||
return
|
||||
@ -181,11 +184,12 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
bannerLink := c.Domain + "/image/serve/" + r.PostFormValue("article-banner-url")
|
||||
bannerLink := r.PostFormValue("article-banner-url")
|
||||
if len(bannerLink) == 0 {
|
||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
bannerLink = c.Domain + "/image/serve/" + bannerLink
|
||||
|
||||
summary := r.PostFormValue("article-summary")
|
||||
if len(summary) == 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user