Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Don't reject an empty string as an invalid avatar
Browse files Browse the repository at this point in the history
Fixes #12257.
  • Loading branch information
David Robertson committed Mar 21, 2022
1 parent 94e8a5f commit ba5fd0f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions synapse/handlers/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,18 @@ async def check_avatar_size_and_mime_type(self, mxc: str) -> bool:
"""Check that the size and content type of the avatar at the given MXC URI are
within the configured limits.
If the given `mxc` is empty, no checks are performed. (Users are always able to
unset their avatar.)
Args:
mxc: The MXC URI at which the avatar can be found.
Returns:
A boolean indicating whether the file can be allowed to be set as an avatar.
"""
if mxc == "":
return True

if not self.max_avatar_size and not self.allowed_avatar_mimetypes:
return True

Expand Down

0 comments on commit ba5fd0f

Please sign in to comment.