aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-04-21 18:24:45 +0200
committerlain <lain@soykaf.club>2018-04-21 18:27:31 +0200
commit0c221943ef588df195a0e36da4d95e164e3094f2 (patch)
tree156ef7250e66fa35dcc1ceb73112052a7a6c294b /lib
parent9e6ae447294d055af6add2efa9aca0024a252fe1 (diff)
downloadpleroma-0c221943ef588df195a0e36da4d95e164e3094f2.tar.gz
Formatter: Use proper escaping for links.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/formatter.ex7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
index 515909af1..a708a275e 100644
--- a/lib/pleroma/formatter.ex
+++ b/lib/pleroma/formatter.ex
@@ -144,7 +144,7 @@ defmodule Pleroma.Formatter do
@emoji
end
- @link_regex ~r/https?:\/\/[\w\.\/?=\-#\+%&@~\(\):]+[\w\/]/u
+ @link_regex ~r/https?:\/\/[\w\.\/?=\-#\+%&@~'\(\):]+[\w\/]/u
def html_escape(text) do
Regex.split(@link_regex, text, include_captures: true)
@@ -168,7 +168,10 @@ defmodule Pleroma.Formatter do
subs =
subs ++
Enum.map(links, fn {uuid, url} ->
- {uuid, "<a href='#{url}'>#{url}</a>"}
+ {:safe, link} = Phoenix.HTML.Link.link(url, to: url)
+ link = link
+ |> IO.iodata_to_binary
+ {uuid, link}
end)
{subs, uuid_text}