From 004fb208c27b223ee84c4c387825ac20ccf0de41 Mon Sep 17 00:00:00 2001 From: freamon Date: Wed, 22 Jan 2025 02:38:12 +0000 Subject: [PATCH] Truncate Announce / Create IDs if they're too long to store in Post or PostReply --- app/activitypub/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index 6108bd25..82169bbc 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -1447,9 +1447,12 @@ def process_new_content(user, community, store_ap_json, request_json, announced) else: in_reply_to = request_json['object']['object']['inReplyTo'] if 'inReplyTo' in request_json['object']['object'] else None ap_id = request_json['object']['object']['id'] - announce_id = request_json['id'] + announce_id = shorten_string(request_json['id'], 100) activity_json = request_json['object'] + # announce / create IDs that are too long will crash the app. Not referred to again, so it shouldn't matter if they're truncated + activity_json['id'] = shorten_string(activity_json['id'], 100) + if not in_reply_to: # Creating a new post post = Post.query.filter_by(ap_id=ap_id).first() if post: