Don't hit the db for coverHandler
This commit is contained in:
parent
7ec326c3ad
commit
2648e8156c
1 changed files with 1 additions and 6 deletions
|
@ -32,17 +32,12 @@ const (
|
||||||
|
|
||||||
func coverHandler(h handler) {
|
func coverHandler(h handler) {
|
||||||
vars := mux.Vars(h.r)
|
vars := mux.Vars(h.r)
|
||||||
book, err := h.db.GetBookID(vars["id"])
|
|
||||||
if err != nil {
|
|
||||||
notFound(h)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
file := coverFile
|
file := coverFile
|
||||||
if vars["size"] == "small" {
|
if vars["size"] == "small" {
|
||||||
file = coverSmallFile
|
file = coverSmallFile
|
||||||
}
|
}
|
||||||
f, err := h.store.Get(book.ID, file)
|
f, err := h.store.Get(vars["id"], file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error while opening image: ", err)
|
log.Error("Error while opening image: ", err)
|
||||||
notFound(h)
|
notFound(h)
|
||||||
|
|
Reference in a new issue