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,