mirror of
https://github.com/caronc/apprise-api.git
synced 2025-03-10 04:18:39 +01:00
Resolved empty attachment handling when feature disabled
This commit is contained in:
parent
4c038de8b3
commit
bb23e50ffe
@ -257,6 +257,14 @@ def parse_attachments(attachment_payload, files_request):
|
|||||||
"""
|
"""
|
||||||
attachments = []
|
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
|
# Attachment Count
|
||||||
count = sum([
|
count = sum([
|
||||||
0 if not isinstance(attachment_payload, (set, tuple, list))
|
0 if not isinstance(attachment_payload, (set, tuple, list))
|
||||||
@ -269,9 +277,6 @@ def parse_attachments(attachment_payload, files_request):
|
|||||||
attachment_payload = (attachment_payload, )
|
attachment_payload = (attachment_payload, )
|
||||||
count += 1
|
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:
|
if settings.APPRISE_MAX_ATTACHMENTS > 0 and count > settings.APPRISE_MAX_ATTACHMENTS:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"There is a maximum of %d attachments" %
|
"There is a maximum of %d attachments" %
|
||||||
|
Loading…
Reference in New Issue
Block a user