1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Merge pull request #6178 from Game4all/fix-html-unescaping

Fix escaped html strings not being unescaped in changelog entries.
This commit is contained in:
Dan Balasescu 2019-09-21 13:11:27 +09:00 committed by GitHub
commit 35f0e07007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -68,6 +68,34 @@ namespace osu.Game.Tests.Visual.Online
changelog.ShowListing();
changelog.Show();
});
AddStep(@"Ensure HTML string unescaping", () =>
{
changelog.ShowBuild(new APIChangelogBuild
{
Version = "2019.920.0",
DisplayVersion = "2019.920.0",
UpdateStream = new APIUpdateStream
{
Name = "Test",
DisplayName = "Test"
},
ChangelogEntries = new List<APIChangelogEntry>
{
new APIChangelogEntry
{
Category = "Testing HTML strings unescaping",
Title = "Ensuring HTML strings are being unescaped",
MessageHtml = "&quot;&quot;&quot;This text should appear triple-quoted&quot;&quot;&quot; &gt;_&lt;",
GithubUser = new APIChangelogUser
{
DisplayName = "Dummy",
OsuUsername = "Dummy",
}
},
}
});
});
}
}
}

View File

@ -14,6 +14,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osuTK.Graphics;
using osu.Framework.Allocation;
using System.Net;
namespace osu.Game.Overlays.Changelog
{
@ -149,7 +150,7 @@ namespace osu.Game.Overlays.Changelog
};
// todo: use markdown parsing once API returns markdown
message.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t =>
message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t =>
{
t.Font = fontSmall;
t.Colour = new Color4(235, 184, 254, 255);