AWS SNS PhoneNumber parameter bugfix (#502)

This commit is contained in:
Ben Mayer 2021-12-23 15:47:57 -06:00 committed by GitHub
parent 5bf89aeefc
commit c06a2f3f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,8 +209,8 @@ class NotifySNS(NotifyBase):
for target in parse_list(targets): for target in parse_list(targets):
result = is_phone_no(target) result = is_phone_no(target)
if result: if result:
# store valid phone number # store valid phone number in E.164 format
self.phone.append('+{}'.format(result)) self.phone.append('+{}'.format(result['full']))
continue continue
result = IS_TOPIC.match(target) result = IS_TOPIC.match(target)
@ -585,8 +585,8 @@ class NotifySNS(NotifyBase):
region=NotifySNS.quote(self.aws_region_name, safe=''), region=NotifySNS.quote(self.aws_region_name, safe=''),
targets='/'.join( targets='/'.join(
[NotifySNS.quote(x) for x in chain( [NotifySNS.quote(x) for x in chain(
# Phone # are prefixed with a plus symbol # Phone # are already prefixed with a plus symbol
['+{}'.format(x) for x in self.phone], self.phone,
# Topics are prefixed with a pound/hashtag symbol # Topics are prefixed with a pound/hashtag symbol
['#{}'.format(x) for x in self.topics], ['#{}'.format(x) for x in self.topics],
)]), )]),