From 96a300ada52dabda197e1a877402ad52335151ef Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Thu, 8 Feb 2024 10:06:46 +0100 Subject: [PATCH] removed type length check for message attachments --- modem/api_validations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modem/api_validations.py b/modem/api_validations.py index b07cec3e..b8257d9c 100644 --- a/modem/api_validations.py +++ b/modem/api_validations.py @@ -9,5 +9,8 @@ def validate_message_attachment(attachment): for field in ['name', 'type', 'data']: if field not in attachment: raise ValueError(f"Attachment missing '{field}'") - if len(attachment[field]) < 1: + + # check for content length, except type + # there are some files out there, don't having a mime type + if len(attachment[field]) < 1 and field not in ["type"]: raise ValueError(f"Attachment has empty '{field}'")