fix(lastfm): don't replace cached artist image with empty on refresh

last.fm intermittently omits the og:image meta tag from artist pages.
previously this would overwrite a good cached image URL with empty, leaving artists without
artwork until the next cache cycle
This commit is contained in:
sentriz
2026-04-14 10:37:46 +01:00
parent 5daf95cdeb
commit ec457fb380
2 changed files with 6 additions and 2 deletions

No files matched your search

+3
View File
@@ -203,6 +203,9 @@ func (c *Client) StealArtistImage(artistURL string) (string, error) {
return "", fmt.Errorf("get artist url: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode/100 != 2 {
return "", fmt.Errorf("get artist url: %s", resp.Status)
}
node, err := html.Parse(resp.Body)
if err != nil {