From cbadf9d3333d3840d21cfcd3bd4f33d3b5b90445 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Sat, 2 Feb 2019 11:38:37 +0300 Subject: [PATCH] Fix rich media relative path --- lib/pleroma/web/mastodon_api/views/status_view.ex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index d5b7e68c7..826563f74 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -184,6 +184,11 @@ def render("status.json", _) 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 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) 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: %{