Do some basic escaping.

This commit is contained in:
Roger Braun 2017-06-14 14:46:18 +02:00
commit 83c657afa5
3 changed files with 16 additions and 2 deletions

View file

@ -11,7 +11,7 @@ defmodule Pleroma.Web.TwitterAPI.Utils do
def add_attachments(text, attachments) do
attachment_text = Enum.map(attachments, fn
(%{"url" => [%{"href" => href} | _]}) ->
"<a href='#{href}' class='attachment'>#{Path.basename(href)}</a>"
"<a href=\"#{URI.encode(href)}\" class='attachment'>#{Path.basename(href)}</a>"
_ -> ""
end)
Enum.join([text | attachment_text], "<br>\n")