Merge branch 'develop' into issue/1276
[akkoma] / lib / pleroma / web / metadata / utils.ex
index 589d11901a0ceb91f50d5da672a909805c0c25ac..000bd9f66f5559a79c525596d9ebf9b4d6338ba1 100644 (file)
@@ -20,16 +20,23 @@ defmodule Pleroma.Web.Metadata.Utils do
   end
 
   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