From 5cc6e18b6c0e1544c5474f7e836e9ff01d01f799 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Wed, 29 Apr 2020 11:30:06 +0100 Subject: [PATCH] Fix fallback value for account_threepid_delegates.email (#7316) --- changelog.d/7316.bugfix | 1 + synapse/config/emailconfig.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelog.d/7316.bugfix diff --git a/changelog.d/7316.bugfix b/changelog.d/7316.bugfix new file mode 100644 index 000000000000..0692696c7bf8 --- /dev/null +++ b/changelog.d/7316.bugfix @@ -0,0 +1 @@ +Fixed backwards compatibility logic of the first value of `trusted_third_party_id_servers` being used for `account_threepid_delegates.email`, which occurs when the former, deprecated option is set and the latter is not. \ No newline at end of file diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index f31fc85ec8bb..76b8957ea502 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -108,9 +108,14 @@ def read_config(self, config, **kwargs): if self.trusted_third_party_id_servers: # XXX: It's a little confusing that account_threepid_delegate_email is modified # both in RegistrationConfig and here. We should factor this bit out - self.account_threepid_delegate_email = self.trusted_third_party_id_servers[ - 0 - ] # type: Optional[str] + + first_trusted_identity_server = self.trusted_third_party_id_servers[0] + + # trusted_third_party_id_servers does not contain a scheme whereas + # account_threepid_delegate_email is expected to. Presume https + self.account_threepid_delegate_email = ( + "https://" + first_trusted_identity_server + ) # type: Optional[str] self.using_identity_server_from_trusted_list = True else: raise ConfigError(