summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAshish Kumar <ashfame@users.noreply.github.com>2022-10-26 18:51:23 +0400
committerGitHub <noreply@github.com>2022-10-26 15:51:23 +0100
commit0cfbb3513152b8360155c2d75df50e06ea861fa4 (patch)
tree00d0e8310bd1fc096de98b022d8b8ee4d2ef9f87 /synapse
parentMerge branch 'master' into develop (diff)
downloadsynapse-0cfbb3513152b8360155c2d75df50e06ea861fa4.tar.xz
fix broken avatar checks when server_name contains a port (#13927)
Fixes check_avatar_size_and_mime_type() to successfully update avatars on homeservers running on non-default ports which it would mistakenly treat as remote homeserver while validating the avatar's size and mime type.

Signed-off-by: Ashish Kumar ashfame@users.noreply.github.com
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/profile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index d8ff5289b5..4bf9a047a3 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -307,7 +307,11 @@ class ProfileHandler:
         if not self.max_avatar_size and not self.allowed_avatar_mimetypes:
             return True
 
-        server_name, _, media_id = parse_and_validate_mxc_uri(mxc)
+        host, port, media_id = parse_and_validate_mxc_uri(mxc)
+        if port is not None:
+            server_name = host + ":" + str(port)
+        else:
+            server_name = host
 
         if server_name == self.server_name:
             media_info = await self.store.get_local_media(media_id)