Merge branch 'bugfix/rich-media-image-nil' into 'develop'

mastodon api: fix rendering of cards without image URLs (closes #597)

Closes #597

See merge request pleroma/pleroma!777
This commit is contained in:
kaniini 2019-02-05 18:53:43 +00:00
commit ecdb0b7f57
2 changed files with 7 additions and 2 deletions

View file

@ -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 =
URI.merge(page_url_data, URI.parse(rich_media[:image])) if rich_media[:image] != nil do
|> to_string 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 site_name = rich_media[:site_name] || page_url_data.host

View file

@ -36,6 +36,7 @@ test "it returns HTTP 200", %{conn: conn} do
describe "GET /api/statusnet/config.json" do describe "GET /api/statusnet/config.json" do
test "it returns the managed config", %{conn: conn} do test "it returns the managed config", %{conn: conn} do
Pleroma.Config.put([:instance, :managed_config], false) Pleroma.Config.put([:instance, :managed_config], false)
Pleroma.Config.put([:fe, :theme], "rei-ayanami-towel")
response = response =
conn conn