From e4d18f328b738a2c3a953e721f0d350cfba20089 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Sat, 2 Feb 2019 11:53:46 +0300 Subject: [PATCH] merge only if page_url is an absolute path --- lib/pleroma/web/mastodon_api/views/status_view.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 826563f74..aa38784a6 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -186,8 +186,12 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do page_url_data = URI.parse(page_url) image_url = - URI.merge(page_url_data, URI.parse(rich_media[:image])) - |> to_string + if %URI{host: nil} = page_url_data do + rich_media[:image] + else + URI.merge(page_url_data, URI.parse(rich_media[:image])) + |> to_string + end site_name = rich_media[:site_name] || page_url_data.host