Check that json is a dict

main
Bob Mottram 2025-09-26 18:02:14 +01:00
parent 19f568dd06
commit 6c4a05123e
1 changed files with 5 additions and 0 deletions

View File

@ -288,6 +288,11 @@ def valid_inbox_filenames(base_dir: str, nickname: str, domain: str,
def inbox_message_has_params(message_json: {}) -> bool:
"""Checks whether an incoming message contains expected parameters
"""
if not isinstance(message_json, dict):
print('WARN: message_json is expected to be a dict ' +
str(message_json))
return False
expected_params = ['actor', 'type', 'object']
for param in expected_params:
if not message_json.get(param):