Fix rich media relative path
authorrinpatch <rinpatch@sdf.org>
Sat, 2 Feb 2019 08:38:37 +0000 (11:38 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 2 Feb 2019 08:38:37 +0000 (11:38 +0300)
lib/pleroma/web/mastodon_api/views/status_view.ex

index d5b7e68c78af54c45673e8fe2636ce0a476fe597..826563f7497813a27f8ba2211e45766db8b45d60 100644 (file)
@@ -184,6 +184,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
   def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
     page_url = rich_media[:url] || page_url
     page_url_data = URI.parse(page_url)
+
+    image_url =
+      URI.merge(page_url_data, URI.parse(rich_media[:image]))
+      |> to_string
+
     site_name = rich_media[:site_name] || page_url_data.host
 
     %{
@@ -191,7 +196,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
       provider_name: site_name,
       provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
       url: page_url,
-      image: rich_media[:image] |> MediaProxy.url(),
+      image: image_url |> MediaProxy.url(),
       title: rich_media[:title],
       description: rich_media[:description],
       pleroma: %{