summary refs log tree commit diff
path: root/synapse/handlers/profile.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-03-25 13:28:42 +0000
committerGitHub <noreply@github.com>2022-03-25 13:28:42 +0000
commitfffb3c4c8f67c271a723855835c2ea0fb83fc33f (patch)
treef2f84efc57ec1d13e08939a45473ba8188385f14 /synapse/handlers/profile.py
parentAuthentik OpenID minor doc update (#12275) (diff)
downloadsynapse-fffb3c4c8f67c271a723855835c2ea0fb83fc33f.tar.xz
Always allow the empty string as an avatar_url. (#12261)
Hopefully this fixes #12257.

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r--synapse/handlers/profile.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 6554c0d3c2..239b0aa744 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -336,12 +336,18 @@ class ProfileHandler:
         """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