diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-09-10 23:13:51 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-09-11 00:56:21 +0200 |
commit | da876d09e89bcfec6f2d1eaddb396f68ce48e12a (patch) | |
tree | 0df3dffb8fcdfce778a9c4bb075774c66fd88bdc | |
parent | 6316350918d1f55167fa384d55f385ff2c93e6bb (diff) | |
download | pleroma-da876d09e89bcfec6f2d1eaddb396f68ce48e12a.tar.gz pleroma-da876d09e89bcfec6f2d1eaddb396f68ce48e12a.zip |
federator: normalize only actor, catch actor error
-rw-r--r-- | lib/pleroma/web/federator/federator.ex | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index f5803578d..e4ab9ba32 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -66,14 +66,17 @@ defmodule Pleroma.Web.Federator do def perform(:incoming_ap_doc, params) do Logger.debug("Handling incoming AP activity") - params = Utils.normalize_params(params) + actor = + params + |> Map.get("actor") + |> Utils.get_ap_id() # NOTE: we use the actor ID to do the containment, this is fine because an # actor shouldn't be acting on objects outside their own AP server. - with {:ok, _user} <- ap_enabled_actor(params["actor"]), + with {_, {:ok, _user}} <- {:actor, ap_enabled_actor(actor)}, nil <- Activity.normalize(params["id"]), {_, :ok} <- - {:correct_origin?, Containment.contain_origin_from_id(params["actor"], params)}, + {:correct_origin?, Containment.contain_origin_from_id(actor, params)}, {:ok, activity} <- Transmogrifier.handle_incoming(params) do {:ok, activity} else @@ -85,10 +88,13 @@ defmodule Pleroma.Web.Federator do Logger.debug("Already had #{params["id"]}") {:error, :already_present} + {:actor, e} -> + Logger.debug("Unhandled actor #{actor}, #{inspect(e)}") + {:error, e} + e -> # Just drop those for now - Logger.debug("Unhandled activity") - Logger.debug(Jason.encode!(params, pretty: true)) + Logger.debug("Unhandled activity\n" <> Jason.encode!(params, pretty: true)) {:error, e} end end |