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

Commit 0248409

Browse files
authored
Handle a display name / avatar URL not included in a federation request. (#9023)
These may be omitted if not set, but Synapse assumed they would be in the response.
1 parent c027a19 commit 0248409

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog.d/9023.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a longstanding issue where an internal server error would occur when requesting a profile over federation that did not include a display name / avatar URL.

synapse/handlers/profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def get_displayname(self, target_user: UserID) -> Optional[str]:
156156
except HttpResponseException as e:
157157
raise e.to_synapse_error()
158158

159-
return result["displayname"]
159+
return result.get("displayname")
160160

161161
async def set_displayname(
162162
self,
@@ -246,7 +246,7 @@ async def get_avatar_url(self, target_user: UserID) -> Optional[str]:
246246
except HttpResponseException as e:
247247
raise e.to_synapse_error()
248248

249-
return result["avatar_url"]
249+
return result.get("avatar_url")
250250

251251
async def set_avatar_url(
252252
self,

0 commit comments

Comments
 (0)