quintodrome/core/artwork
bobo-xxx 28eba567a7
fix(artwork): return correct timestamp when disc or album coverart changes (#5378)
* fix(artwork): return imagesUpdatedAt in LastUpdated when cover art changes

When cover art (cover.jpg) is updated in an album folder, the HTTP
Last-Modified header was incorrectly returning album.UpdatedAt (which
only tracks media file changes) instead of imagesUpdatedAt (which
tracks cover art changes).

This caused browsers to use their cached cover art because the
Last-Modified header didn't change, even though the actual cover art
image data was new (due to cache key changing based on imagesUpdatedAt).

The fix ensures LastUpdated() returns a.lastUpdate (which is the max of
album.UpdatedAt and imagesUpdatedAt) instead of always returning
album.UpdatedAt.

Fixes navidrome/navidrome#5377

* refactor tests

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(artwork): return imagesUpdatedAt in disc LastUpdated

The discArtworkReader had the same bug as albumArtworkReader (fixed in
9a741859f): LastUpdated() returned album.UpdatedAt while Key() used the
max of album.UpdatedAt and ImagesUpdatedAt. This mismatch caused browsers
to keep stale disc cover art in cache when only the image file changed.

Also strengthen the album LastUpdated tests and add matching tests for
the disc reader. The tests use DescribeTable and were verified to fail
when the fix is reverted.

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2026-04-17 21:35:33 -04:00
..
animation.go feat(artwork): preserve animated image artwork during resize (#5184) 2026-03-13 18:11:12 -04:00
animation_test.go feat(artwork): preserve animated image artwork during resize (#5184) 2026-03-13 18:11:12 -04:00
artwork.go feat(ui): add cover art support for internet radio stations (#5229) 2026-03-18 18:57:33 -04:00
artwork_internal_test.go fix(artwork): return correct timestamp when disc or album coverart changes (#5378) 2026-04-17 21:35:33 -04:00
artwork_suite_test.go Fix tests and clean up code a bit 2022-12-28 15:31:56 -05:00
artwork_test.go Fix image stuttering (#3035) 2024-05-24 20:19:26 -04:00
benchmark_decode_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
benchmark_e2e_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
benchmark_encode_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
benchmark_helpers_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
benchmark_pipeline_test.go feat(artwork): preserve animated image artwork during resize (#5184) 2026-03-13 18:11:12 -04:00
benchmark_tag_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
cache_warmer.go fix(artwork): address WebP performance regression on low-power hardware (#5286) 2026-04-04 15:17:01 -04:00
cache_warmer_test.go fix(artwork): address WebP performance regression on low-power hardware (#5286) 2026-04-04 15:17:01 -04:00
image_cache.go Add lastUpdated to coverArt ids. Helps with invalidating art cache client-side. 2023-02-08 20:03:31 -05:00
reader_album.go fix(artwork): return correct timestamp when disc or album coverart changes (#5378) 2026-04-17 21:35:33 -04:00
reader_album_test.go fix(artwork): search parent folders for album cover art in multi-disc layouts (#5157) 2026-03-09 10:52:13 -04:00
reader_artist.go feat: add artist image uploads and image-folder artwork source (#5198) 2026-03-15 22:19:55 -04:00
reader_artist_test.go feat: add artist image uploads and image-folder artwork source (#5198) 2026-03-15 22:19:55 -04:00
reader_disc.go fix(artwork): return correct timestamp when disc or album coverart changes (#5378) 2026-04-17 21:35:33 -04:00
reader_disc_test.go fix(artwork): allow shared disc art from unnumbered filenames in single-folder albums (#5344) 2026-04-11 21:19:57 -04:00
reader_mediafile.go fix(artwork): fallback mediafile cover art to disc artwork before album (#5216) 2026-03-16 18:08:39 -04:00
reader_playlist.go feat(ui): increase cover art size to 600px and use CatmullRom scaling 2026-03-22 14:55:14 -04:00
reader_radio.go feat(ui): add cover art support for internet radio stations (#5229) 2026-03-18 18:57:33 -04:00
reader_radio_test.go feat(ui): add cover art support for internet radio stations (#5229) 2026-03-18 18:57:33 -04:00
reader_resized.go fix(artwork): address WebP performance regression on low-power hardware (#5286) 2026-04-04 15:17:01 -04:00
reader_resized_test.go fix(artwork): preserve animation for square thumbnails with animated images 2026-04-01 08:38:29 -04:00
sources.go fix(artwork): validate ffmpeg pipe before returning in cover art fallback 2026-03-30 07:01:38 -04:00
wire_providers.go Handle "naked" CoverArtIDs (IDs of album, mediafiles and playlists) 2022-12-28 15:31:56 -05:00