Don't hit the db for coverHandler

This commit is contained in:
Las Zenow 2021-04-26 18:16:44 +00:00
parent 7ec326c3ad
commit 2648e8156c

View file

@ -32,17 +32,12 @@ const (
func coverHandler(h handler) {
vars := mux.Vars(h.r)
book, err := h.db.GetBookID(vars["id"])
if err != nil {
notFound(h)
return
}
file := coverFile
if vars["size"] == "small" {
file = coverSmallFile
}
f, err := h.store.Get(book.ID, file)
f, err := h.store.Get(vars["id"], file)
if err != nil {
log.Error("Error while opening image: ", err)
notFound(h)