Avoid circularity in conversation resolution

main
Bob Mottram 2024-05-29 17:34:09 +01:00
parent 159e03a782
commit 3dba69c19a
1 changed files with 8 additions and 0 deletions

View File

@ -306,6 +306,7 @@ def download_conversation_posts(authorized: bool, session,
session, as_header, debug, session, as_header, debug,
http_prefix, domain, 0, []) http_prefix, domain, 0, [])
ids = []
while get_json_valid(post_json_object): while get_json_valid(post_json_object):
if not isinstance(post_json_object, dict): if not isinstance(post_json_object, dict):
break break
@ -355,6 +356,13 @@ def download_conversation_posts(authorized: bool, session,
if not post_json_object['object'].get('published'): if not post_json_object['object'].get('published'):
break break
# avoid any circularity in previous conversation posts
if post_json_object.get('id'):
if isinstance(post_json_object['id'], str):
if post_json_object['id'] in ids:
break
ids.append(post_json_object['id'])
# render harmless any dangerous markup # render harmless any dangerous markup
harmless_markup(post_json_object) harmless_markup(post_json_object)