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/handlers/user_directory.py | |
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/handlers/user_directory.py')
-rw-r--r-- | synapse/handlers/user_directory.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py index 521b6d620d..e21f8dbc58 100644 --- a/synapse/handlers/user_directory.py +++ b/synapse/handlers/user_directory.py @@ -234,7 +234,7 @@ class UserDirectoryHandler(StateDeltasHandler): async def _handle_room_publicity_change( self, room_id, prev_event_id, event_id, typ ): - """Handle a room having potentially changed from/to world_readable/publically + """Handle a room having potentially changed from/to world_readable/publicly joinable. Args: @@ -388,9 +388,15 @@ class UserDirectoryHandler(StateDeltasHandler): prev_name = prev_event.content.get("displayname") new_name = event.content.get("displayname") + # If the new name is an unexpected form, do not update the directory. + if not isinstance(new_name, str): + new_name = prev_name prev_avatar = prev_event.content.get("avatar_url") new_avatar = event.content.get("avatar_url") + # If the new avatar is an unexpected form, do not update the directory. + if not isinstance(new_avatar, str): + new_avatar = prev_avatar if prev_name != new_name or prev_avatar != new_avatar: await self.store.update_profile_in_user_dir(user_id, new_name, new_avatar) |