mastodon api: rich media: don't clobber %URI struct with a string

This commit is contained in:
William Pitcock 2019-02-06 18:02:15 +00:00
parent c46490b199
commit 65a4b9fbea
1 changed files with 4 additions and 2 deletions

View File

@ -182,11 +182,13 @@ def render("status.json", _) do
end
def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
page_url_data = URI.parse(page_url)
page_url_data =
if rich_media[:url] != nil do
URI.merge(URI.parse(page_url), URI.parse(rich_media[:url]))
URI.merge(page_url_data, URI.parse(rich_media[:url]))
else
page_url
page_url_data
end
page_url = page_url_data |> to_string