Fix usage of is_bitstring instead of is_binary
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
|
||||
end
|
||||
|
||||
@spec get_address(map | binary | nil) :: integer | nil
|
||||
defp get_address(address_url) when is_bitstring(address_url) do
|
||||
defp get_address(address_url) when is_binary(address_url) do
|
||||
get_address(%{"id" => address_url})
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Media do
|
||||
%{"type" => "Document", "url" => media_url, "name" => name},
|
||||
actor_id
|
||||
)
|
||||
when is_bitstring(media_url) do
|
||||
when is_binary(media_url) do
|
||||
with {:ok, %{body: body}} <- Tesla.get(media_url, opts: @http_options),
|
||||
{:ok, %{name: name, url: url, content_type: content_type, size: size}} <-
|
||||
Upload.store(%{body: body, name: name}),
|
||||
|
||||
@@ -94,7 +94,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Utils do
|
||||
end
|
||||
end
|
||||
|
||||
defp fetch_tag(tag) when is_bitstring(tag), do: [tag_without_hash(tag)]
|
||||
defp fetch_tag(tag) when is_binary(tag), do: [tag_without_hash(tag)]
|
||||
|
||||
defp tag_without_hash("#" <> tag_title), do: tag_title
|
||||
defp tag_without_hash(tag_title), do: tag_title
|
||||
|
||||
Reference in New Issue
Block a user