Handle ActivityPub Fetcher returning text that's not JSON

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-03-16 16:50:43 +01:00
parent 27a1d92e52
commit 6fe22ac6ed
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -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