X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fformatter.ex;h=5b63fb795efbd2cfe4e956ed6f8cd614b99e236b;hb=52b05137c5800186fffee83950c83194a3468057;hp=62f54a3f255e2e74d5e7c6dc7dfa7ff1f83d4e46;hpb=ac486fc59b49d26db7c3b6b61d0affeb34f9b3e0;p=akkoma diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 62f54a3f2..5b63fb795 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -192,7 +192,11 @@ defmodule Pleroma.Formatter do ] # TODO: make it use something other than @link_regex - def html_escape(text) do + def html_escape(text, "text/html") do + HTML.filter_tags(text) + end + + def html_escape(text, "text/plain") do Regex.split(@link_regex, text, include_captures: true) |> Enum.map_every(2, fn chunk -> {:safe, part} = Phoenix.HTML.html_escape(chunk) @@ -222,13 +226,7 @@ defmodule Pleroma.Formatter do subs = subs ++ Enum.map(links, fn {uuid, url} -> - {:safe, link} = Phoenix.HTML.Link.link(url, to: url) - - link = - link - |> IO.iodata_to_binary() - - {uuid, link} + {uuid, "#{url}"} end) {subs, uuid_text}