diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-09-01 13:02:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 13:02:41 -0400 |
commit | b939251c37d748a4be6346eb27bd5fdfaff17738 (patch) | |
tree | 0db61d4ee0eb7cdf72cf437f5458113621296b0b /synapse/storage/databases | |
parent | Explain better what GDPR-erased means (#8189) (diff) | |
download | synapse-b939251c37d748a4be6346eb27bd5fdfaff17738.tar.xz |
Fix errors when updating the user directory with invalid data (#8223)
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r-- | synapse/storage/databases/main/user_directory.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/user_directory.py b/synapse/storage/databases/main/user_directory.py index 1e96ae7828..c977db042e 100644 --- a/synapse/storage/databases/main/user_directory.py +++ b/synapse/storage/databases/main/user_directory.py @@ -371,6 +371,11 @@ class UserDirectoryBackgroundUpdateStore(StateDeltasStore): """ Update or add a user's profile in the user directory. """ + # If the display name or avatar URL are unexpected types, overwrite them. + if not isinstance(display_name, str): + display_name = None + if not isinstance(avatar_url, str): + avatar_url = None def _update_profile_in_user_dir_txn(txn): new_entry = self.db_pool.simple_upsert_txn( |