From 351427ead3a2d51dd1239f0756a72118e095913c Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 18 Mar 2024 13:56:37 -0300 Subject: [PATCH] Update SongMetaBuilder.cs trimming values for labels (to avoid possible problems) --- .../Runtime/Song/Builder/SongMetaBuilder.cs | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/UltraStar Play/Packages/playshared/Runtime/Song/Builder/SongMetaBuilder.cs b/UltraStar Play/Packages/playshared/Runtime/Song/Builder/SongMetaBuilder.cs index 929be3b64..755c4e928 100644 --- a/UltraStar Play/Packages/playshared/Runtime/Song/Builder/SongMetaBuilder.cs +++ b/UltraStar Play/Packages/playshared/Runtime/Song/Builder/SongMetaBuilder.cs @@ -155,49 +155,50 @@ public static SongMeta ParseFile(string path, out List songIssues, En ); foreach (var item in otherFields) { + string trimmedValue = item.Value.Trim(); switch (item.Key) { case "background": - songMeta.Background = item.Value; + songMeta.Background = trimmedValue; break; case "cover": - songMeta.Cover = item.Value; + songMeta.Cover = trimmedValue; break; case "edition": - songMeta.Edition = item.Value; + songMeta.Edition = trimmedValue; break; case "end": - songMeta.End = ConvertToFloat(item.Value); + songMeta.End = ConvertToFloat(trimmedValue); break; case "gap": - songMeta.Gap = ConvertToFloat(item.Value); + songMeta.Gap = ConvertToFloat(trimmedValue); break; case "genre": - songMeta.Genre = item.Value; + songMeta.Genre = trimmedValue; break; case "language": - songMeta.Language = item.Value; + songMeta.Language = trimmedValue; break; case "previewstart": - songMeta.PreviewStart = ConvertToFloat(item.Value); + songMeta.PreviewStart = ConvertToFloat(trimmedValue); break; case "previewend": - songMeta.PreviewEnd = ConvertToFloat(item.Value); + songMeta.PreviewEnd = ConvertToFloat(trimmedValue); break; case "start": - songMeta.Start = ConvertToFloat(item.Value); + songMeta.Start = ConvertToFloat(trimmedValue); break; case "video": - songMeta.Video = item.Value; + songMeta.Video = trimmedValue; break; case "videogap": - songMeta.VideoGap = ConvertToFloat(item.Value); + songMeta.VideoGap = ConvertToFloat(trimmedValue); break; case "year": - songMeta.Year = ConvertToUInt32(item.Value); + songMeta.Year = ConvertToUInt32(trimmedValue); break; default: - songMeta.SetUnknownHeaderEntry(item.Key, item.Value); + songMeta.SetUnknownHeaderEntry(item.Key, trimmedValue); break; } }