From 8d119223d4f8f5a5c2170630d8f9cee50f4b1115 Mon Sep 17 00:00:00 2001 From: freamon Date: Thu, 23 Jan 2025 05:07:54 +0000 Subject: [PATCH] Small fixes for incoming AP --- app/activitypub/routes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index 82169bbc..f9efa26b 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -503,7 +503,7 @@ def shared_inbox(): return '' if missing_actor_in_announce_object: - if ((request_json['object']['type'] == 'Create' or request_json['object']['type']) and + if ((request_json['object']['type'] == 'Create' or request_json['object']['type'] == 'Update') and 'attributedTo' in request_json['object']['object'] and isinstance(request_json['object']['object']['attributedTo'], str)): log_incoming_ap(id, APLOG_ANNOUNCE, APLOG_MONITOR, request_json, 'nodebb: Actor is missing in the Create') request_json['object']['actor'] = request_json['object']['object']['attributedTo'] @@ -587,7 +587,7 @@ def replay_inbox_request(request_json): return if missing_actor_in_announce_object: - if ((request_json['object']['type'] == 'Create' or request_json['object']['type']) and + if ((request_json['object']['type'] == 'Create' or request_json['object']['type'] == 'Update') and 'attributedTo' in request_json['object']['object'] and isinstance(request_json['object']['object']['attributedTo'], str)): request_json['object']['actor'] = request_json['object']['object']['attributedTo'] @@ -770,7 +770,7 @@ def process_inbox_request(request_json, store_ap_json): if core_activity['type'] == 'Create' or core_activity['type'] == 'Update': if isinstance(core_activity['object'], str): core_activity = verify_object_from_source(core_activity) # change core_activity['object'] from str to dict, then process normally - if not request_json: + if not core_activity: log_incoming_ap(id, APLOG_CREATE, APLOG_FAILURE, saved_json, 'Could not verify unsigned request from source') return