From f7ebdec1d53d9949805c3c9275451b98814bbb99 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 2 Mar 2024 09:13:49 +1300 Subject: [PATCH] Microblog posts sometimes get Announced by lemmy. They don't have a title, so we can't use them. --- app/activitypub/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 2ccef279..2209dfa5 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -1186,6 +1186,8 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json activity_log.exception_message = 'Community is local only, post discarded' activity_log.result = 'ignored' return None + if 'name' not in request_json['object']: # Microblog posts sometimes get Announced by lemmy. They don't have a title, so we can't use them. + return None nsfl_in_title = '[NSFL]' in request_json['object']['name'].upper() or '(NSFL)' in request_json['object']['name'].upper() post = Post(user_id=user.id, community_id=community.id, title=html.unescape(request_json['object']['name']),