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.
This commit is contained in:
faried nawaz 2023-03-06 02:31:31 +05:00
commit 141146d1f1
2 changed files with 43 additions and 6 deletions

View file

@ -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