aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-02-05 18:30:27 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2019-02-05 18:30:27 +0000
commit1d94b67e409010e4da20b4d325813390d9d8bb73 (patch)
treead9fd12ef9229dc9df02b15d5e33595f2e223928
parent03991e7bc5c6309739d8e936ce312a68d9e73b5a (diff)
downloadpleroma-1d94b67e409010e4da20b4d325813390d9d8bb73.tar.gz
mastodon api: fix rendering of cards without image URLs (closes #597)
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex8
1 files 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 d1b11d4f1..c0e289ef8 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -192,8 +192,12 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
page_url = page_url_data |> to_string
image_url =
- URI.merge(page_url_data, URI.parse(rich_media[:image]))
- |> to_string
+ if rich_media[:image] != nil do
+ URI.merge(page_url_data, URI.parse(rich_media[:image]))
+ |> to_string
+ else
+ nil
+ end
site_name = rich_media[:site_name] || page_url_data.host