mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
Truncate Announce / Create IDs if they're too long to store in Post or PostReply
This commit is contained in:
parent
e5516adf48
commit
004fb208c2
1 changed files with 4 additions and 1 deletions
|
@ -1447,9 +1447,12 @@ def process_new_content(user, community, store_ap_json, request_json, announced)
|
||||||
else:
|
else:
|
||||||
in_reply_to = request_json['object']['object']['inReplyTo'] if 'inReplyTo' in request_json['object']['object'] else None
|
in_reply_to = request_json['object']['object']['inReplyTo'] if 'inReplyTo' in request_json['object']['object'] else None
|
||||||
ap_id = request_json['object']['object']['id']
|
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']
|
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
|
if not in_reply_to: # Creating a new post
|
||||||
post = Post.query.filter_by(ap_id=ap_id).first()
|
post = Post.query.filter_by(ap_id=ap_id).first()
|
||||||
if post:
|
if post:
|
||||||
|
|
Loading…
Reference in a new issue