mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Parse HTML entities during APINewsPost deserialisation
This commit is contained in:
parent
c86bb2e755
commit
857a027a73
@ -39,9 +39,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
}),
|
||||
new NewsCard(new APINewsPost
|
||||
{
|
||||
Title = "This post has a full-url image!",
|
||||
Preview = "boom",
|
||||
Author = "user",
|
||||
Title = "This post has a full-url image! (HTML entity: &)",
|
||||
Preview = "boom (HTML entity: &)",
|
||||
Author = "user (HTML entity: &)",
|
||||
FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
|
||||
PublishedAt = DateTimeOffset.Now
|
||||
})
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
@ -11,8 +12,14 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
private string author;
|
||||
|
||||
[JsonProperty("author")]
|
||||
public string Author { get; set; }
|
||||
public string Author
|
||||
{
|
||||
get => author;
|
||||
set => author = WebUtility.HtmlDecode(value);
|
||||
}
|
||||
|
||||
[JsonProperty("edit_url")]
|
||||
public string EditUrl { get; set; }
|
||||
@ -29,10 +36,22 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty("slug")]
|
||||
public string Slug { get; set; }
|
||||
|
||||
private string title;
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
public string Title
|
||||
{
|
||||
get => title;
|
||||
set => title = WebUtility.HtmlDecode(value);
|
||||
}
|
||||
|
||||
private string preview;
|
||||
|
||||
[JsonProperty("preview")]
|
||||
public string Preview { get; set; }
|
||||
public string Preview
|
||||
{
|
||||
get => preview;
|
||||
set => preview = WebUtility.HtmlDecode(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user