Merge branch 'bugfix/osada-mention' into 'develop'
[akkoma] / lib / pleroma / formatter.ex
index c0a176184f0b32327b8d646c0c04ab0323123b4d..21b08a62e29b577031becbfaba24a84612cb7730 100644 (file)
@@ -193,7 +193,7 @@ defmodule Pleroma.Formatter do
 
   # TODO: make it use something other than @link_regex
   def html_escape(text, "text/html") do
-    HtmlSanitizeEx.basic_html(text)
+    HTML.filter_tags(text)
   end
 
   def html_escape(text, "text/plain") do
@@ -248,7 +248,12 @@ defmodule Pleroma.Formatter do
     subs =
       subs ++
         Enum.map(mentions, fn {match, %User{ap_id: ap_id, info: info}, uuid} ->
-          ap_id = info["source_data"]["url"] || ap_id
+          ap_id =
+            if is_binary(info["source_data"]["url"]) do
+              info["source_data"]["url"]
+            else
+              ap_id
+            end
 
           short_match = String.split(match, "@") |> tl() |> hd()