From 1d94b67e409010e4da20b4d325813390d9d8bb73 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 5 Feb 2019 18:30:27 +0000 Subject: [PATCH 1/2] mastodon api: fix rendering of cards without image URLs (closes #597) --- 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 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 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) 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 From c4d317ccb679f7fef11983b9629249e047bec4db Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 5 Feb 2019 18:49:02 +0000 Subject: [PATCH 2/2] test: twitterapi: fix the test breakage for real --- test/web/twitter_api/util_controller_test.exs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index dc9bad369..8e152ecd4 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/web/twitter_api/util_controller_test.exs @@ -36,6 +36,7 @@ test "it returns HTTP 200", %{conn: conn} do describe "GET /api/statusnet/config.json" do test "it returns the managed config", %{conn: conn} do Pleroma.Config.put([:instance, :managed_config], false) + Pleroma.Config.put([:fe, :theme], "rei-ayanami-towel") response = conn