From f448a6bbad35711404129751bf301062e692cec0 Mon Sep 17 00:00:00 2001 From: Marcello Pichini <46926852+marcello-pichini@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:06:12 +0100 Subject: [PATCH] fix(jukebox): fall back to the file name when a track's embedded title is empty (#5701) * fix(jukebox): fall back to the file name when a track's embedded title is empty panelTracksFromRom used ?? for the title, so an empty tag stayed an empty title, while the catalog path (panelTracksFromCatalog) already falls back to the file name with ||. Co-Authored-By: Claude Sonnet 5.5 * test(jukebox): type the empty-title fixture instead of casting it Co-Authored-By: Claude Sonnet 5.5 --------- Co-authored-by: Claude Sonnet 5.5 --- frontend/src/utils/soundtrackTracks.test.ts | 8 ++++++++ frontend/src/utils/soundtrackTracks.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/soundtrackTracks.test.ts b/frontend/src/utils/soundtrackTracks.test.ts index 6df7938de..b68d4d010 100644 --- a/frontend/src/utils/soundtrackTracks.test.ts +++ b/frontend/src/utils/soundtrackTracks.test.ts @@ -89,6 +89,14 @@ describe("panelTracksFromRom", () => { expect(track?.title).toBe("01 - Theme"); expect(track?.subtitle).toBe(""); }); + + it("falls back to the file name when the embedded title is empty", () => { + const [track] = panelTracksFromRom( + rom([romFile(1, "theme.mp3")]), + new Map([[1, { title: "" }]]), + ); + expect(track?.title).toBe("theme"); + }); }); describe("panelTracksFromCatalog", () => { diff --git a/frontend/src/utils/soundtrackTracks.ts b/frontend/src/utils/soundtrackTracks.ts index d98ff97b8..98832697d 100644 --- a/frontend/src/utils/soundtrackTracks.ts +++ b/frontend/src/utils/soundtrackTracks.ts @@ -86,7 +86,7 @@ export function panelTracksFromRom( id: file.id, romId: rom.id, fileName: file.file_name, - title: meta?.title ?? stripExtension(file.file_name), + title: meta?.title || stripExtension(file.file_name), subtitle: joinParts([meta?.artist, meta?.album]), url: romFileUrl(file.id, file.file_name), durationSeconds: meta?.duration_seconds ?? undefined,