From 54efb85240f50f97f9b94361a8c9ada8a1911442 Mon Sep 17 00:00:00 2001 From: Antti Kettunen Date: Tue, 19 May 2026 19:51:54 +0300 Subject: [PATCH] fix(webui): guard similar artist bubbles - avoid calling buildArtistDetailPath when a similar artist has no usable id - render a disabled bubble instead so empty MusicBrainz IDs do not crash the panel --- webui/static/shared-helpers.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/static/shared-helpers.js b/webui/static/shared-helpers.js index 26745e78..e5aeb0bc 100644 --- a/webui/static/shared-helpers.js +++ b/webui/static/shared-helpers.js @@ -3832,14 +3832,23 @@ function displaySimilarArtists(artists) { * Create a similar artist bubble card element */ function createSimilarArtistBubble(artist) { + const artistId = artist.id ? String(artist.id).trim() : ''; + const hasArtistDetail = !!artistId; + // Create bubble container - const bubble = document.createElement('a'); + const bubble = document.createElement(hasArtistDetail ? 'a' : 'div'); bubble.className = 'similar-artist-bubble'; - bubble.href = buildArtistDetailPath(artist.id, artist.source || null); + if (hasArtistDetail) { + bubble.href = buildArtistDetailPath(artistId, artist.source || null); + } else { + bubble.setAttribute('aria-disabled', 'true'); + bubble.style.cursor = 'default'; + bubble.style.pointerEvents = 'none'; + } bubble.style.color = 'inherit'; bubble.style.textDecoration = 'none'; bubble.setAttribute('aria-label', artist.name); - bubble.setAttribute('data-artist-id', artist.id); + bubble.setAttribute('data-artist-id', artistId); bubble.setAttribute('data-artist-source', artist.source || ''); if (artist.plugin) { bubble.setAttribute('data-artist-plugin', artist.plugin);