mirror of
https://github.com/rommapp/romm.git
synced 2026-12-02 18:18:47 +01:00
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 <noreply@anthropic.com> * test(jukebox): type the empty-title fixture instead of casting it Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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<number, TrackMetaSchema>([[1, { title: "" }]]),
|
||||
);
|
||||
expect(track?.title).toBe("theme");
|
||||
});
|
||||
});
|
||||
|
||||
describe("panelTracksFromCatalog", () => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user