Merge pull request #109 from LumaLivy/html-decode-strings

(Website) Decode html escape sequences in user comments
This commit is contained in:
jvyden 2021-12-18 02:22:44 -05:00 committed by GitHub
commit 2d8fd1c2c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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