From 6fe22ac6ed406aa9a1ed94a686b262eae3eb81d6 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 16 Mar 2021 16:50:43 +0100 Subject: [PATCH] Handle ActivityPub Fetcher returning text that's not JSON Signed-off-by: Thomas Citharel --- lib/federation/activity_pub/fetcher.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/federation/activity_pub/fetcher.ex b/lib/federation/activity_pub/fetcher.ex index a6ece6a36..e23c7d163 100644 --- a/lib/federation/activity_pub/fetcher.ex +++ b/lib/federation/activity_pub/fetcher.ex @@ -59,6 +59,10 @@ defmodule Mobilizon.Federation.ActivityPub.Fetcher do Logger.warn("Object origin check failed") {:error, "Object origin check failed"} + # Returned content is not JSON + {:ok, data} when is_binary(data) -> + {:error, "Failed to parse content as JSON"} + {:error, err} -> {:error, err} end