Fix usage of is_bitstring instead of is_binary

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-04-08 16:41:49 +02:00
parent b79c2815fc
commit bd53bfc46b
10 changed files with 19 additions and 13 deletions

View File

@@ -127,7 +127,7 @@ defmodule Mobilizon.Federation.ActivityPub.Refresher do
do: process_collection(first, on_behalf_of)
defp process_collection(%{"type" => "OrderedCollection", "first" => first}, on_behalf_of)
when is_bitstring(first) do
when is_binary(first) do
Logger.debug("OrderedCollection has a first property pointing to an URI")
with {:ok, data} <- Fetcher.fetch(first, on_behalf_of: on_behalf_of) do

View File

@@ -126,7 +126,7 @@ defmodule Mobilizon.Federation.ActivityPub.Relay do
end
end
defp fetch_object(object) when is_bitstring(object), do: {object, object}
defp fetch_object(object) when is_binary(object), do: {object, object}
@spec fetch_actor(String.t()) :: {:ok, String.t()} | {:error, String.t()}
# Dirty hack

View File

@@ -26,7 +26,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
# Some implementations send the actor URI as the actor field, others send the entire actor object,
# so figure out what the actor's URI is based on what we have.
def get_url(%{"id" => id}), do: id
def get_url(id) when is_bitstring(id), do: id
def get_url(id) when is_binary(id), do: id
def get_url(ids) when is_list(ids), do: get_url(hd(ids))
def get_url(_), do: nil
@@ -223,7 +223,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
end
end
def get_actor(%{"actor" => %{"id" => id}}) when is_bitstring(id) do
def get_actor(%{"actor" => %{"id" => id}}) when is_binary(id) do
id
end