diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-12-10 07:17:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 07:17:28 -0500 |
commit | 9562f0c2f1bd3489bfbb64fddbbd21ed657b44dd (patch) | |
tree | 89c60cececaf4b4c83784f814b840ad61d5e3baa /synapse/storage/databases/main | |
parent | Do not allow cross-room relations, per MSC2674. (#11516) (diff) | |
download | synapse-9562f0c2f1bd3489bfbb64fddbbd21ed657b44dd.tar.xz |
Ensure emails are canonicalized before fetching associated user. (#11547)
This should fix pushers with an email in non-canonical form is used as the pushkey.
Diffstat (limited to 'synapse/storage/databases/main')
-rw-r--r-- | synapse/storage/databases/main/monthly_active_users.py | 3 | ||||
-rw-r--r-- | synapse/storage/databases/main/registration.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/monthly_active_users.py b/synapse/storage/databases/main/monthly_active_users.py index b5284e4f67..3c98ef876f 100644 --- a/synapse/storage/databases/main/monthly_active_users.py +++ b/synapse/storage/databases/main/monthly_active_users.py @@ -18,6 +18,7 @@ from synapse.metrics.background_process_metrics import wrap_as_background_proces from synapse.storage._base import SQLBaseStore from synapse.storage.database import DatabasePool, make_in_list_sql_clause from synapse.util.caches.descriptors import cached +from synapse.util.threepids import canonicalise_email if TYPE_CHECKING: from synapse.server import HomeServer @@ -103,7 +104,7 @@ class MonthlyActiveUsersWorkerStore(SQLBaseStore): : self.hs.config.server.max_mau_value ]: user_id = await self.hs.get_datastore().get_user_id_by_threepid( - tp["medium"], tp["address"] + tp["medium"], canonicalise_email(tp["address"]) ) if user_id: users.append(user_id) diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index e1ddf06916..86c3425716 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -856,7 +856,8 @@ class RegistrationWorkerStore(CacheInvalidationWorkerStore): Args: medium: threepid medium e.g. email - address: threepid address e.g. me@example.com + address: threepid address e.g. me@example.com. This must already be + in canonical form. Returns: The user ID or None if no user id/threepid mapping exists |