mastodon api: rich media: don't clobber %URI struct with a string
authorWilliam Pitcock <nenolod@dereferenced.org>
Wed, 6 Feb 2019 18:02:15 +0000 (18:02 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 6 Feb 2019 18:02:15 +0000 (18:02 +0000)
lib/pleroma/web/mastodon_api/views/status_view.ex

index c0e289ef8013b7ed3a1e6a1b9a84e0ed2ff627cd..a227d742d8a162e86e5bc6c8d140ba4bbe58297f 100644 (file)
@@ -182,11 +182,13 @@ defmodule Pleroma.Web.MastodonAPI.StatusView 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