summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-09-01 13:02:41 -0400
committerGitHub <noreply@github.com>2020-09-01 13:02:41 -0400
commitb939251c37d748a4be6346eb27bd5fdfaff17738 (patch)
tree0db61d4ee0eb7cdf72cf437f5458113621296b0b /synapse/storage
parentExplain better what GDPR-erased means (#8189) (diff)
downloadsynapse-b939251c37d748a4be6346eb27bd5fdfaff17738.tar.xz
Fix errors when updating the user directory with invalid data (#8223)
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/user_directory.py5
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(