mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
fix(ui): serve the placeholder for known-absent art instead of a broken icon
getCoverArtUrl returned '' for an imageAbsent record, so <img src={undefined}> rendered as the browser's broken-image icon on every absent cover. The server already serves a proper placeholder for absent art, so build the url and let it render.
This commit is contained in:
parent
a1eb5e8343
commit
20557f2fb8
@ -81,10 +81,6 @@ const getAvatarUrl = (username, size) =>
|
||||
)
|
||||
|
||||
const getCoverArtUrl = (record, size, square) => {
|
||||
// Known-absent art would only ever return a placeholder; skip the round trip entirely.
|
||||
if (record.imageAbsent) {
|
||||
return ''
|
||||
}
|
||||
const suffix = record.imageHash ? '_' + record.imageHash : ''
|
||||
const options = {
|
||||
// A hash-suffixed url is already pixel-versioned; the buster would defeat immutable caching.
|
||||
|
||||
@ -151,14 +151,15 @@ describe('getCoverArtUrl', () => {
|
||||
expect(url).toContain('_=')
|
||||
})
|
||||
|
||||
it('returns an empty url for known-absent artwork', () => {
|
||||
expect(
|
||||
subsonic.getCoverArtUrl({
|
||||
id: 'album-123',
|
||||
albumArtist: 'AA',
|
||||
imageAbsent: true,
|
||||
}),
|
||||
).toBe('')
|
||||
it('still builds a url for known-absent artwork so the server placeholder renders', () => {
|
||||
// Returning '' here made <img src=undefined> render as a broken icon; the server serves a
|
||||
// proper placeholder for absent art, so the client must still request it.
|
||||
const url = subsonic.getCoverArtUrl({
|
||||
id: 'album-123',
|
||||
albumArtist: 'AA',
|
||||
imageAbsent: true,
|
||||
})
|
||||
expect(url).toContain('al-album-123')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user