fix(pushover): ignore unsupported attachments as intended instead of discarding the entire notification (#650)

pull/686/head
Ryan Young 2 years ago committed by GitHub
parent f1990b14ce
commit e9f040a2d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -432,24 +432,25 @@ class NotifyPushover(NotifyBase):
attach.mimetype, attach.mimetype,
attach.url(privacy=True))) attach.url(privacy=True)))
return True attach = None
# If we get here, we're dealing with a supported image. else:
# Verify that the filesize is okay though. # If we get here, we're dealing with a supported image.
file_size = len(attach) # Verify that the filesize is okay though.
if not (file_size > 0 file_size = len(attach)
and file_size <= self.attach_max_size_bytes): if not (file_size > 0
and file_size <= self.attach_max_size_bytes):
# File size is no good # File size is no good
self.logger.warning( self.logger.warning(
'Pushover attachment size ({}B) exceeds limit: {}' 'Pushover attachment size ({}B) exceeds limit: {}'
.format(file_size, attach.url(privacy=True))) .format(file_size, attach.url(privacy=True)))
return False return False
self.logger.debug( self.logger.debug(
'Posting Pushover attachment {}'.format( 'Posting Pushover attachment {}'.format(
attach.url(privacy=True))) attach.url(privacy=True)))
# Default Header # Default Header
headers = { headers = {

Loading…
Cancel
Save