diff --git a/cmd/frontend/issues.go b/cmd/frontend/issues.go index 10eefce..a17b625 100644 --- a/cmd/frontend/issues.go +++ b/cmd/frontend/issues.go @@ -30,6 +30,14 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun return } + title := r.PostFormValue("issue-title") + if len(title) == 0 { + err = fmt.Errorf("error: no title for issue specified") + log.Println(err) + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if session.Values["issue-image"] == nil { err := "error: Image required" log.Println(err) @@ -55,14 +63,11 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun return } - imgSize := imgInfo.Size() - mimeType := mime.TypeByExtension(filepath.Ext(imgAbsName)) - article := &b.Article{ - Title: r.PostFormValue("issue-title"), + Title: title, EncURL: fmt.Sprint(c.Domain, "/image/serve/", imgFileName), - EncLength: int(imgSize), - EncType: mimeType, + EncLength: int(imgInfo.Size()), + EncType: mime.TypeByExtension(filepath.Ext(imgAbsName)), Published: true, Rejected: false, Created: time.Now(), diff --git a/web/templates/current-articles.html b/web/templates/current-articles.html index 177bae4..4e9ebdb 100644 --- a/web/templates/current-articles.html +++ b/web/templates/current-articles.html @@ -18,7 +18,7 @@

Titelseite

- + diff --git a/web/templates/index.html b/web/templates/index.html index 9842930..1afc3c4 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -35,7 +35,7 @@

© 2024 Jason Streifling. Alle Rechte vorbehalten.

-

v0.11.0 - Alpha: Änderungen und Fehler möglich.

+

v0.11.0 - Alpha: Drastische Änderungen und Fehler vorbehalten.