diff sat/plugins/plugin_comp_ap_gateway/__init__.py @ 3852:384ad98ea9fe

component AP gateway: we need to use `actor` and not `attributedTo` for activities: `attributedTo` may not be filled, notably when the object is a string URL
author Goffi <goffi@goffi.org>
date Thu, 14 Jul 2022 12:55:30 +0200
parents ef824b1091f3
children a56d5ad466b3
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_ap_gateway/__init__.py	Thu Jul 14 12:55:30 2022 +0200
+++ b/sat/plugins/plugin_comp_ap_gateway/__init__.py	Thu Jul 14 12:55:30 2022 +0200
@@ -970,7 +970,7 @@
                         comment_node = comment_data["node"]
                         await self._p.subscribe(client, comment_service, comment_node)
                 ap_item = await self.mbdata2APitem(client, mb_data)
-                url_actor = ap_item["object"]["attributedTo"]
+                url_actor = ap_item["actor"]
             elif item.name == "retract":
                 url_actor, ap_item = await self.apDeleteItem(
                     client.jid, node, item["id"]
@@ -1690,7 +1690,7 @@
             raise exceptions.DataError("Can't get ActivityPub actor inbox")
 
         item_data = await self.mbdata2APitem(client, mess_data)
-        url_actor = item_data["object"]["attributedTo"]
+        url_actor = item_data["actor"]
         resp = await self.signAndPost(inbox_url, url_actor, item_data)
         if resp.code != 202:
             raise exceptions.NetworkError(f"unexpected return code: {resp.code}")