Unify maximum message length in bytes

main
Bob Mottram 2024-11-02 12:51:51 +00:00
parent f4af6a139b
commit c5f07a1a1c
2 changed files with 5 additions and 3 deletions

View File

@ -537,7 +537,8 @@ def update_inbox_queue(self, nickname: str, message_json: {},
self.server.blocked_cache,
self.server.block_federated,
self.server.system_language,
mitm)
mitm,
self.server.maxMessageLength)
if queue_filename:
# add json to the queue
if queue_filename not in self.server.inbox_queue:

View File

@ -395,11 +395,12 @@ def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
blocked_cache: [],
block_federated: [],
system_language: str,
mitm: bool) -> str:
mitm: bool,
max_message_bytes: int) -> str:
"""Saves the given json to the inbox queue for the person
key_id specifies the actor sending the post
"""
if len(message_bytes) > 20000:
if len(message_bytes) > max_message_bytes:
print('REJECT: inbox message too long ' +
str(len(message_bytes)) + ' bytes')
return None