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{
|
article := &b.Article{
|
||||||
Title: r.PostFormValue("article-title"),
|
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"),
|
Summary: r.PostFormValue("article-summary"),
|
||||||
Published: false,
|
Published: false,
|
||||||
Rejected: 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)
|
http.Error(w, "Bitte den Titel eingeben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(article.BannerLink) == 0 {
|
if len(article.BannerLink) == 0 {
|
||||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
article.BannerLink = c.Domain + "/image/serve/" + article.BannerLink
|
||||||
|
|
||||||
if len(article.Summary) == 0 {
|
if len(article.Summary) == 0 {
|
||||||
http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest)
|
http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
@ -181,11 +184,12 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
bannerLink := c.Domain + "/image/serve/" + r.PostFormValue("article-banner-url")
|
bannerLink := r.PostFormValue("article-banner-url")
|
||||||
if len(bannerLink) == 0 {
|
if len(bannerLink) == 0 {
|
||||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
bannerLink = c.Domain + "/image/serve/" + bannerLink
|
||||||
|
|
||||||
summary := r.PostFormValue("article-summary")
|
summary := r.PostFormValue("article-summary")
|
||||||
if len(summary) == 0 {
|
if len(summary) == 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user