diff --git a/apprise_api/api/utils.py b/apprise_api/api/utils.py index 81b1672..b573216 100644 --- a/apprise_api/api/utils.py +++ b/apprise_api/api/utils.py @@ -257,6 +257,14 @@ def parse_attachments(attachment_payload, files_request): """ attachments = [] + if settings.APPRISE_ATTACH_SIZE <= 0: + if not (attachment_payload and files_request): + # No further processing required + return [] + + # Otherwise we need to raise an error + raise ValueError("Attachment support has been disabled") + # Attachment Count count = sum([ 0 if not isinstance(attachment_payload, (set, tuple, list)) @@ -269,9 +277,6 @@ def parse_attachments(attachment_payload, files_request): attachment_payload = (attachment_payload, ) count += 1 - if settings.APPRISE_ATTACH_SIZE <= 0: - raise ValueError("Attachment support has been disabled") - if settings.APPRISE_MAX_ATTACHMENTS > 0 and count > settings.APPRISE_MAX_ATTACHMENTS: raise ValueError( "There is a maximum of %d attachments" %