merge only if page_url is an absolute path
authorrinpatch <rinpatch@sdf.org>
Sat, 2 Feb 2019 08:53:46 +0000 (11:53 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 2 Feb 2019 08:53:46 +0000 (11:53 +0300)
lib/pleroma/web/mastodon_api/views/status_view.ex

index 826563f7497813a27f8ba2211e45766db8b45d60..aa38784a69ffaa835333699a0d82a1f6df16ea67 100644 (file)
@@ -186,8 +186,12 @@ defmodule Pleroma.Web.MastodonAPI.StatusView 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