Return 404 when artwork is not available in /share/img endpoint

This commit is contained in:
Deluan
2023-01-31 18:22:49 -05:00
committed by Deluan Quintão
parent 128b626ec9
commit d8e794317f
13 changed files with 75 additions and 90 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ func (api *Router) GetCoverArt(w http.ResponseWriter, r *http.Request) (*respons
id := utils.ParamString(r, "id")
size := utils.ParamInt(r, "size", 0)
imgReader, lastUpdate, err := api.artwork.Get(ctx, id, size)
imgReader, lastUpdate, err := api.artwork.GetOrPlaceholder(ctx, id, size)
w.Header().Set("cache-control", "public, max-age=315360000")
w.Header().Set("last-modified", lastUpdate.Format(time.RFC1123))
@@ -67,7 +67,7 @@ func (api *Router) GetCoverArt(w http.ResponseWriter, r *http.Request) (*respons
case errors.Is(err, context.Canceled):
return nil, nil
case errors.Is(err, model.ErrNotFound):
log.Error(r, "Couldn't find coverArt", "id", id, err)
log.Warn(r, "Couldn't find coverArt", "id", id, err)
return nil, newError(responses.ErrorDataNotFound, "Artwork not found")
case err != nil:
log.Error(r, "Error retrieving coverArt", "id", id, err)