aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/metadata/utils.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/metadata/utils.ex')
-rw-r--r--lib/pleroma/web/metadata/utils.ex13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/pleroma/web/metadata/utils.ex b/lib/pleroma/web/metadata/utils.ex
index 589d11901..000bd9f66 100644
--- a/lib/pleroma/web/metadata/utils.ex
+++ b/lib/pleroma/web/metadata/utils.ex
@@ -21,15 +21,22 @@ defmodule Pleroma.Web.Metadata.Utils do
def scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do
content
+ |> scrub_html
+ |> Emoji.Formatter.demojify()
+ |> HtmlEntities.decode()
+ |> Formatter.truncate(max_length)
+ end
+
+ def scrub_html(content) when is_binary(content) do
+ content
# html content comes from DB already encoded, decode first and scrub after
|> HtmlEntities.decode()
|> String.replace(~r/<br\s?\/?>/, " ")
|> HTML.strip_tags()
- |> Emoji.Formatter.demojify()
- |> HtmlEntities.decode()
- |> Formatter.truncate(max_length)
end
+ def scrub_html(content), do: content
+
def attachment_url(url) do
MediaProxy.url(url)
end