mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:02:57 +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
|
new NewsCard(new APINewsPost
|
||||||
{
|
{
|
||||||
Title = "This post has a full-url image!",
|
Title = "This post has a full-url image! (HTML entity: &)",
|
||||||
Preview = "boom",
|
Preview = "boom (HTML entity: &)",
|
||||||
Author = "user",
|
Author = "user (HTML entity: &)",
|
||||||
FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
|
FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
|
||||||
PublishedAt = DateTimeOffset.Now
|
PublishedAt = DateTimeOffset.Now
|
||||||
})
|
})
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests.Responses
|
namespace osu.Game.Online.API.Requests.Responses
|
||||||
{
|
{
|
||||||
@ -11,8 +12,14 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
private string author;
|
||||||
|
|
||||||
[JsonProperty("author")]
|
[JsonProperty("author")]
|
||||||
public string Author { get; set; }
|
public string Author
|
||||||
|
{
|
||||||
|
get => author;
|
||||||
|
set => author = WebUtility.HtmlDecode(value);
|
||||||
|
}
|
||||||
|
|
||||||
[JsonProperty("edit_url")]
|
[JsonProperty("edit_url")]
|
||||||
public string EditUrl { get; set; }
|
public string EditUrl { get; set; }
|
||||||
@ -29,10 +36,22 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty("slug")]
|
[JsonProperty("slug")]
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
private string title;
|
||||||
|
|
||||||
[JsonProperty("title")]
|
[JsonProperty("title")]
|
||||||
public string Title { get; set; }
|
public string Title
|
||||||
|
{
|
||||||
|
get => title;
|
||||||
|
set => title = WebUtility.HtmlDecode(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string preview;
|
||||||
|
|
||||||
[JsonProperty("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