X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fmetadata%2Futils.ex;h=2f0dfb474b16e8d1780d15bb6e606be4922b4378;hb=349b9d86dc25ae9514781ef2ac56953fa357a031;hp=589d11901a0ceb91f50d5da672a909805c0c25ac;hpb=12b28c8925c2c55e0d7bb66ff3320532a1aade3b;p=akkoma
diff --git a/lib/pleroma/web/metadata/utils.ex b/lib/pleroma/web/metadata/utils.ex
index 589d11901..2f0dfb474 100644
--- a/lib/pleroma/web/metadata/utils.ex
+++ b/lib/pleroma/web/metadata/utils.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Utils do
@@ -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/
/, " ")
|> 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