Truncate Announce / Create IDs if they're too long to store in Post or PostReply

This commit is contained in:
freamon 2025-01-22 02:38:12 +00:00
parent e5516adf48
commit 004fb208c2

View file

@ -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: