From bb4130d48c4831e704155b45fed889dc71efd254 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 11 Jun 2021 19:23:35 -0500 Subject: [PATCH] Demojify does not decode for us --- lib/pleroma/web/metadata/utils.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/metadata/utils.ex b/lib/pleroma/web/metadata/utils.ex index 0a4a3f628..4c763a877 100644 --- a/lib/pleroma/web/metadata/utils.ex +++ b/lib/pleroma/web/metadata/utils.ex @@ -36,8 +36,9 @@ defmodule Pleroma.Web.Metadata.Utils do end defp do_filter_html_and_truncate(content, max_length \\ 200) when is_binary(content) do - # html content comes from DB already encoded, but demojify decodes for us + # html content comes from DB already encoded content + |> HtmlEntities.decode() |> Emoji.Formatter.demojify() |> HTML.filter_tags(Pleroma.HTML.Scrubber.BreaksOnly) |> HtmlEntities.decode() @@ -46,8 +47,9 @@ defmodule Pleroma.Web.Metadata.Utils do end defp do_scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do - # html content comes from DB already encoded, but demojify decodes for us + # html content comes from DB already encoded content + |> HtmlEntities.decode() |> Emoji.Formatter.demojify() |> String.replace(~r//, " ") |> HTML.strip_tags()