From 6e1856ffac87d54ecacbc9f3e305c8989cfd1288 Mon Sep 17 00:00:00 2001 From: Code by Ben Date: Sun, 11 Aug 2024 14:10:17 +1000 Subject: [PATCH] empty song title fixes. --- internal/magicnumber/synthesismusic.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/magicnumber/synthesismusic.go b/internal/magicnumber/synthesismusic.go index 75bc5755..2bf87d16 100644 --- a/internal/magicnumber/synthesismusic.go +++ b/internal/magicnumber/synthesismusic.go @@ -63,8 +63,9 @@ func MusicMTM(p []byte) string { } s := "MultiTrack song" song := string(bytes.Trim(p[offset:headerLen+offset], "\x00")) + song = strings.TrimSpace(song) if song != "" { - s += fmt.Sprintf(", %q", strings.TrimSpace(song)) + s += fmt.Sprintf(", %q", song) } return s } @@ -81,8 +82,9 @@ func MusicIT(p []byte) string { } s := "Impulse Tracker song" song := string(bytes.Trim(p[offset:headerLen+offset], "\x00")) + song = strings.TrimSpace(song) if song != "" { - s += fmt.Sprintf(", %q", strings.TrimSpace(song)) + s += fmt.Sprintf(", %q", song) } return s } @@ -103,8 +105,9 @@ func MusicXM(p []byte) string { } s := "extended module tracked music" song := string(bytes.Trim(p[offset:headerLen+offset], "\x00")) + song = strings.TrimSpace(song) if song != "" { - s += fmt.Sprintf(", %q", strings.TrimSpace(song)) + s += fmt.Sprintf(", %q", song) } return s }