mirror of
https://github.com/caronc/apprise-api.git
synced 2024-11-07 16:54:10 +01:00
Fixed Bad Attachment Web/API Error; refs #168
This commit is contained in:
parent
d556f14d0a
commit
ecc8655583
@ -283,6 +283,10 @@ class AttachmentTests(SimpleTestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
parse_attachments(attachment_payload, {})
|
||||
|
||||
# We allow empty entries, this is okay; there is just nothing
|
||||
# returned at the end of the day
|
||||
assert parse_attachments({''}, {}) == []
|
||||
|
||||
# We can't parse entries that are not base64 but specified as
|
||||
# though they are
|
||||
attachment_payload = {
|
||||
|
@ -178,7 +178,6 @@ class HTTPAttachment(A_MGR['http']):
|
||||
'Could not prepare {} attachment in {}'.format(
|
||||
filename, settings.APPRISE_ATTACH_DIR))
|
||||
|
||||
|
||||
# Prepare our item
|
||||
super().__init__(name=filename, **kwargs)
|
||||
|
||||
@ -272,6 +271,14 @@ def parse_attachments(attachment_payload, files_request):
|
||||
# Prepare our Attachment
|
||||
#
|
||||
if isinstance(entry, str):
|
||||
if not entry.strip():
|
||||
# ignore blank entries; these can come from using the
|
||||
# api/website and submitting without an element defined.
|
||||
# There is no need have a bad outcome; just decrement our
|
||||
# counter and move along
|
||||
count -= 1
|
||||
continue
|
||||
|
||||
if not re.match(r'^https?://.+', entry[:10], re.I):
|
||||
# We failed to retrieve the product
|
||||
raise ValueError(
|
||||
|
Loading…
Reference in New Issue
Block a user