diff --git a/src/Common/Constants.cs b/src/Common/Constants.cs index 34dda003e..5242950fc 100644 --- a/src/Common/Constants.cs +++ b/src/Common/Constants.cs @@ -9,6 +9,6 @@ public static class Constants public const string WebUIName = "p2g_webui"; public const string ClientUIName = "p2g_clientui"; - public const string AppVersion = "4.1.0"; + public const string AppVersion = "4.2.0-rc"; } } diff --git a/src/Common/Helpers/WorkoutHelper.cs b/src/Common/Helpers/WorkoutHelper.cs index df6c5fcf7..31687dc28 100644 --- a/src/Common/Helpers/WorkoutHelper.cs +++ b/src/Common/Helpers/WorkoutHelper.cs @@ -2,6 +2,7 @@ using Common.Dto.Peloton; using HandlebarsDotNet; using System.IO; +using System.Web; namespace Common.Helpers; @@ -27,7 +28,7 @@ public static string GetTitle(Workout workout, Format settings) var template = settings.WorkoutTitleTemplate; if (string.IsNullOrWhiteSpace(template)) template = new Format().WorkoutTitleTemplate; - + var compiledTemplate = Handlebars.Compile(settings.WorkoutTitleTemplate); var title = compiledTemplate(templateData); @@ -38,7 +39,8 @@ public static string GetTitle(Workout workout, Format settings) cleanedTitle = cleanedTitle.Replace(c, InvalidCharacterReplacer); } - return cleanedTitle; + var result = HttpUtility.HtmlDecode(cleanedTitle); + return result; } public static string GetUniqueTitle(Workout workout, Format settings) diff --git a/src/UnitTests/Common/Helpers/WorkoutHelperTests.cs b/src/UnitTests/Common/Helpers/WorkoutHelperTests.cs index 9e97c9bf1..f6e3501a9 100644 --- a/src/UnitTests/Common/Helpers/WorkoutHelperTests.cs +++ b/src/UnitTests/Common/Helpers/WorkoutHelperTests.cs @@ -31,6 +31,25 @@ public string GetTitle_Should_ReplaceInvalidChars(string title, string instructo return WorkoutHelper.GetTitle(workout, new Format()); } + [TestCase("My Title", "é", ExpectedResult = "My_Title_with_é")] + [TestCase("My Title", "ä", ExpectedResult = "My_Title_with_ä")] + public string GetTitle_Should_Handle_SpecialChars(string title, string instructor) + { + var workout = new Workout() + { + Ride = new Ride() + { + Title = title, + Instructor = new Instructor() + { + Name = instructor + } + } + }; + + return WorkoutHelper.GetTitle(workout, new Format()); + } + [Test] public void GetTitle_NullRide_ShouldReturn_RideId() { diff --git a/vNextReleaseNotes.md b/vNextReleaseNotes.md index daf07c39e..667f68470 100644 --- a/vNextReleaseNotes.md +++ b/vNextReleaseNotes.md @@ -3,20 +3,10 @@ ## Features -- [#564] [#591] Set a custom title on Workouts using templating -- [#559] Ability to exclude Outdoor Cycling workouts from sycning -- [#600] Annual Challenge page now let's you know how many minutes you will need per day/week in order to meet the goal by the end of the year (based on the remaining time left) ## Fixes -- [#581] Fix broken Documentation link in UI -- [#580] Console Client couldn't load configuration file correctly (introduced by #564) -- [#588] Fix Annual Challenge page still trying to load 2023 -- [#578] Fix VO2 and TE not updating on Garmin Connect - -## Docs - -- [#521] Called out that `\` special character is not currently supported in passwords +- [#604] Fix workout title template not handling special characters correctly ## Docker Tags