Work on image rendering

This commit is contained in:
Dominic Ferrando
2025-04-18 14:38:46 -04:00
parent ac9c516550
commit 4265b8583b
9 changed files with 53 additions and 22 deletions
+7 -6
View File
@@ -102,9 +102,9 @@ func main() {
return
}
if len(posts) == 0 {
if len(posts) == 0 || posts[0].MediaPath == "" {
http.Error(w, "Malformed thread", http.StatusInternalServerError)
log.Printf("Thread %d has no posts", thread.Id)
log.Printf("Thread %d has no posts or no OP image", threadId)
return
}
@@ -182,9 +182,9 @@ func main() {
return
}
if len(posts) == 0 {
if len(posts) == 0 || posts[0].MediaPath == "" {
http.Error(w, "Malformed thread", http.StatusInternalServerError)
log.Printf("Thread %d has no posts", thread.Id)
log.Printf("Thread %d has no posts or no OP image", thread.Id)
return
}
@@ -192,6 +192,7 @@ func main() {
Subject: thread.Subject,
Body: posts[0].Body,
ThreadURL: fmt.Sprintf("/%s/threads/%d", slug, thread.Id),
MediaPath: posts[0].MediaPath,
})
}
@@ -216,9 +217,9 @@ func main() {
return
}
if len(posts) == 0 {
if len(posts) == 0 || posts[0].MediaPath == "" {
http.Error(w, "Malformed thread", http.StatusInternalServerError)
log.Printf("Thread %d has no posts", threadId)
log.Printf("Thread %d has no posts or no OP image", threadId)
return
}