merge-requests/30/head
Bob Mottram 2022-05-31 14:45:18 +01:00
parent c8ff37bd5b
commit 8a6361b9a6
1 changed files with 6 additions and 4 deletions

View File

@ -536,8 +536,7 @@ def is_create_inside_announce(item: {}) -> bool:
def _get_posts(session, outbox_url: str, max_posts: int, def _get_posts(session, outbox_url: str, max_posts: int,
max_mentions: int, max_mentions: int,
max_emoji: int, max_attachments: int, max_emoji: int, max_attachments: int,
federation_list: [], federation_list: [], raw: bool,
person_cache: {}, raw: bool,
simple: bool, debug: bool, simple: bool, debug: bool,
project_version: str, http_prefix: str, project_version: str, http_prefix: str,
origin_domain: str, system_language: str, origin_domain: str, system_language: str,
@ -663,6 +662,10 @@ def _get_posts(session, outbox_url: str, max_posts: int,
in_reply_to = this_item['inReplyTo'] in_reply_to = this_item['inReplyTo']
if this_item.get('attachment'): if this_item.get('attachment'):
if len(this_item['attachment']) > max_attachments:
if debug:
print('max attachments reached')
continue
if this_item['attachment']: if this_item['attachment']:
for attach in this_item['attachment']: for attach in this_item['attachment']:
if attach.get('name') and attach.get('url'): if attach.get('name') and attach.get('url'):
@ -4437,8 +4440,7 @@ def get_public_posts_of_person(base_dir: str, nickname: str, domain: str,
max_emoji = 10 max_emoji = 10
max_attachments = 5 max_attachments = 5
_get_posts(session, person_url, 30, max_mentions, max_emoji, _get_posts(session, person_url, 30, max_mentions, max_emoji,
max_attachments, federation_list, max_attachments, federation_list, raw, simple, debug,
person_cache, raw, simple, debug,
project_version, http_prefix, origin_domain, system_language, project_version, http_prefix, origin_domain, system_language,
signing_priv_key_pem) signing_priv_key_pem)