From e689f9eeac94fefe0f1032f52b9e54e0e4db9179 Mon Sep 17 00:00:00 2001 From: Brian Murray Date: Fri, 12 Jul 2024 14:16:42 -0700 Subject: [PATCH] policies/email.py: do not return empty email addresses --- britney2/policies/email.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/britney2/policies/email.py b/britney2/policies/email.py index 349bf91..d62cb60 100644 --- a/britney2/policies/email.py +++ b/britney2/policies/email.py @@ -154,6 +154,8 @@ class EmailPolicy(BasePolicy, Rest): if match: addresses.append(match.group(1)) address = self.addresses[person] = address_chooser(addresses) + if not address: + return None return address except HTTPError as e: if e.code != 410: # suspended user @@ -166,6 +168,8 @@ class EmailPolicy(BasePolicy, Rest): def scrape_gpg_emails(self, people): """Find email addresses from GPG keys.""" emails = [self._scrape_gpg_emails(person) for person in (people or [])] + if not emails: + return return [email for email in emails if email is not None] def lp_get_emails(self, pkg, version):