Fix checking origin from a tombstone
When comparing an activity with their origin, only compare the ID directly, as Tombstones don't have actors anymore Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -142,7 +142,7 @@ defmodule Mobilizon.Federation.ActivityPub.Fetcher do
|
||||
true
|
||||
else
|
||||
Sentry.capture_message("Object origin check failed", extra: %{url: url, data: data})
|
||||
Logger.debug("Object origin check failed")
|
||||
Logger.debug("Object origin check failed between #{inspect(url)} and #{inspect(data)}")
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -239,6 +239,8 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
|
||||
|
||||
Takes the actor or attributedTo attributes (considers only the first elem if they're an array)
|
||||
"""
|
||||
def origin_check?(id, %{"type" => "Tombstone", "id" => tombstone_id}), do: id == tombstone_id
|
||||
|
||||
def origin_check?(id, %{"actor" => actor, "attributedTo" => _attributed_to} = params)
|
||||
when not is_nil(actor) and actor != "" do
|
||||
params = Map.delete(params, "attributedTo")
|
||||
|
||||
Reference in New Issue
Block a user