From 2648e8156cd3d708b5ae50b36bfaef3043d76d99 Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Mon, 26 Apr 2021 18:16:44 +0000 Subject: [PATCH] Don't hit the db for coverHandler --- lib/cover.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/cover.go b/lib/cover.go index 0ecc8bf..59c0633 100644 --- a/lib/cover.go +++ b/lib/cover.go @@ -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)