From 7107a76f5fe9c0f38d69bcd3c4d5414c083d9244 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Wed, 12 Apr 2023 11:28:06 +0100 Subject: [PATCH] [OOBE][What's New]Hide hotfix installer hashes (#25418) --- .../Settings.UI/OOBE/Views/OobeWhatsNew.xaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/OOBE/Views/OobeWhatsNew.xaml.cs b/src/settings-ui/Settings.UI/OOBE/Views/OobeWhatsNew.xaml.cs index eb123e1c7d..d5cece086b 100644 --- a/src/settings-ui/Settings.UI/OOBE/Views/OobeWhatsNew.xaml.cs +++ b/src/settings-ui/Settings.UI/OOBE/Views/OobeWhatsNew.xaml.cs @@ -56,7 +56,8 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views /// Regex to remove installer hash sections from the release notes. /// private const string RemoveInstallerHashesRegex = @"(\r\n)+## Installer Hashes(\r\n.*)+## Highlights"; - private const RegexOptions RemoveInstallerHashesRegexOptions = RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant; + private const string RemoveHotFixInstallerHashesRegex = @"(\r\n)+## Installer Hashes(\r\n.*)+$"; + private const RegexOptions RemoveInstallerHashesRegexOptions = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant; private static async Task GetReleaseNotesMarkdown() { @@ -86,10 +87,14 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views // Regex to remove installer hash sections from the release notes. Regex removeHashRegex = new Regex(RemoveInstallerHashesRegex, RemoveInstallerHashesRegexOptions); + // Regex to remove installer hash sections from the release notes, since there'll be no Highlights section for hotfix releases. + Regex removeHotfixHashRegex = new Regex(RemoveHotFixInstallerHashesRegex, RemoveInstallerHashesRegexOptions); + foreach (var release in latestReleases) { releaseNotesHtmlBuilder.AppendLine("# " + release.Name); var notes = removeHashRegex.Replace(release.ReleaseNotes, "\r\n## Highlights"); + notes = removeHotfixHashRegex.Replace(notes, string.Empty); releaseNotesHtmlBuilder.AppendLine(notes); releaseNotesHtmlBuilder.AppendLine(" "); }