Skip to content

Commit 7d38b48

Browse files
authored
Merge branch 'main' into main
2 parents acb7bc3 + a95c071 commit 7d38b48

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

source/DasBlog.Web.Repositories/BlogManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,15 @@ public CommentSaveState AddComment(string postid, Comment comment)
363363
{
364364
var targetComment = DateTime.UtcNow.AddDays(-1 * dasBlogSettings.SiteConfiguration.DaysCommentsAllowed);
365365

366-
if (targetComment > entry.CreatedUtc)
366+
if ((targetComment > entry.CreatedUtc))
367367
{
368368
return CommentSaveState.PostCommentsDisabled;
369369
}
370370

371+
// FilterHtml html encodes anything we don't like
372+
string filteredText = dasBlogSettings.FilterHtml(comment.Content);
373+
comment.Content = filteredText;
374+
371375
if (dasBlogSettings.SiteConfiguration.SendCommentsByEmail)
372376
{
373377
var actions = ComposeMailForUsers(entry, comment);

source/DasBlog.Web.UI/Controllers/BlogPostController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ public IActionResult AddComment(AddCommentViewModel addcomment)
447447
commt.EntryId = Guid.NewGuid().ToString();
448448
commt.IsPublic = !dasBlogSettings.SiteConfiguration.CommentsRequireApproval;
449449

450+
logger.LogInformation(new EventDataItem(EventCodes.CommentAdded, null, "Comment CONTENT DUMP", commt.Content));
451+
450452
var state = blogManager.AddComment(addcomment.TargetEntryId, commt);
451453

452454
if (state == NBR.CommentSaveState.Failed)

source/DasBlog.Web.UI/TagHelpers/Comments/CommentContentTagHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
2727
{
2828
output.TagName = "div";
2929
output.TagMode = TagMode.StartTagAndEndTag;
30-
output.Attributes.SetAttribute("class", Css);
30+
31+
output.Attributes.SetAttribute("class", Css);
3132
Comment.Text = dasBlogSettings.FilterHtml(Comment.Text);
3233
Comment.Text = Regex.Replace(Comment.Text, "\n", "<br />");
3334
output.Content.SetHtmlContent(HttpUtility.HtmlDecode(Comment.Text));

0 commit comments

Comments
 (0)