From 141146d1f11a0a6581cc3161547ea597c92d56e9 Mon Sep 17 00:00:00 2001 From: faried nawaz Date: Mon, 6 Mar 2023 02:31:31 +0500 Subject: use scrub_html_and_truncate instead of scrub_html for feed item title Sometimes this truncated properly encoded HTML entities in the wrong place. The new flow calls scrub_html, removes emojis, decodes entities (a second time), truncates, and then re-encodes. Fixes #3045. --- lib/pleroma/web/feed/feed_view.ex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/feed/feed_view.ex b/lib/pleroma/web/feed/feed_view.ex index 3cb717288..9b7426792 100644 --- a/lib/pleroma/web/feed/feed_view.ex +++ b/lib/pleroma/web/feed/feed_view.ex @@ -83,9 +83,8 @@ defmodule Pleroma.Web.Feed.FeedView do end title - |> Pleroma.Web.Metadata.Utils.scrub_html() - |> Pleroma.Emoji.Formatter.demojify() - |> Formatter.truncate(opts[:max_length], opts[:omission]) + |> Pleroma.Web.Metadata.Utils.scrub_html_and_truncate(opts[:max_length], opts[:omission]) + |> HtmlEntities.encode() end def activity_description(data) do -- cgit v1.2.3