summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorfaried nawaz <faried@gmail.com>2023-03-06 02:31:31 +0500
committerfaried nawaz <faried@gmail.com>2023-03-06 02:38:02 +0500
commit141146d1f11a0a6581cc3161547ea597c92d56e9 (patch)
treeac8c5f5a83e38d6c03e58faaedb7b000b609202e /lib
parent86ee4b72f3a54016bcc7e7f3ea8c386eca34e4b0 (diff)
downloadpleroma-141146d1f11a0a6581cc3161547ea597c92d56e9.tar.gz
pleroma-141146d1f11a0a6581cc3161547ea597c92d56e9.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/feed/feed_view.ex5
1 files changed, 2 insertions, 3 deletions
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