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