forked from AkkomaGang/akkoma
mastodon api: fix rendering of cards without image URLs (closes #597)
This commit is contained in:
parent
03991e7bc5
commit
1d94b67e40
1 changed files with 6 additions and 2 deletions
|
@ -192,8 +192,12 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
||||||
page_url = page_url_data |> to_string
|
page_url = page_url_data |> to_string
|
||||||
|
|
||||||
image_url =
|
image_url =
|
||||||
|
if rich_media[:image] != nil do
|
||||||
URI.merge(page_url_data, URI.parse(rich_media[:image]))
|
URI.merge(page_url_data, URI.parse(rich_media[:image]))
|
||||||
|> to_string
|
|> to_string
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
site_name = rich_media[:site_name] || page_url_data.host
|
site_name = rich_media[:site_name] || page_url_data.host
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue