Skip to content

Commit

Permalink
Return error when no matching cover is found
Browse files Browse the repository at this point in the history
When checking stored references to cover images (whether embedded or
external), it's possible that configured patterns do no match, and a
valid error should be returned in those cases.
  • Loading branch information
deuill authored and deluan committed Jun 25, 2020
1 parent 08cd28a commit d9c991e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engine/cover.go
Expand Up @@ -135,6 +135,7 @@ func (c *cover) getCover(ctx context.Context, path string, size int) (reader io.
}
}()
var data []byte
err = errors.New("no matching cover found")
for _, p := range strings.Split(conf.Server.CoverArtPriority, ",") {
pat := strings.ToLower(strings.TrimSpace(p))
if pat == "embedded" {
Expand All @@ -147,7 +148,9 @@ func (c *cover) getCover(ctx context.Context, path string, size int) (reader io.
}
}

if err == nil && size > 0 {
if err != nil {
return
} else if size > 0 {
data, err = resizeImage(bytes.NewReader(data), size)
}

Expand Down

0 comments on commit d9c991e

Please sign in to comment.