Decode escaped HTML sequences

This commit is contained in:
LumaLivy 2021-12-17 16:29:30 -05:00
commit 4967b2de55

View file

@ -2,6 +2,8 @@
@using LBPUnion.ProjectLighthouse.Types @using LBPUnion.ProjectLighthouse.Types
@using LBPUnion.ProjectLighthouse.Types.Profiles @using LBPUnion.ProjectLighthouse.Types.Profiles
@using LBPUnion.ProjectLighthouse.Types.Settings @using LBPUnion.ProjectLighthouse.Types.Settings
@using System.Web;
@using System.IO;
@model LBPUnion.ProjectLighthouse.Pages.UserPage @model LBPUnion.ProjectLighthouse.Pages.UserPage
@{ @{
@ -92,9 +94,12 @@
@foreach (Comment comment in Model.Comments!) @foreach (Comment comment in Model.Comments!)
{ {
DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000); DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000);
StringWriter messageWriter = new StringWriter();
HttpUtility.HtmlDecode(comment.Message, messageWriter);
String decodedMessage = messageWriter.ToString();
<div> <div>
<b><a href="/user/@comment.PosterUserId">@comment.Poster.Username</a>: </b> <b><a href="/user/@comment.PosterUserId">@comment.Poster.Username</a>: </b>
<span>@comment.Message</span> <span>@decodedMessage</span>
<p> <p>
<i>@timestamp.ToString("MM/dd/yyyy @ h:mm tt") UTC</i> <i>@timestamp.ToString("MM/dd/yyyy @ h:mm tt") UTC</i>
</p> </p>