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

Commit

Permalink
Handle a display name / avatar URL not included in a federation reque…
Browse files Browse the repository at this point in the history
…st. (#9023)

These may be omitted if not set, but Synapse assumed they would
be in the response.
  • Loading branch information
clokep committed Jan 6, 2021
1 parent c027a19 commit 0248409
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/9023.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +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.
4 changes: 2 additions & 2 deletions synapse/handlers/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async def get_displayname(self, target_user: UserID) -> Optional[str]:
except HttpResponseException as e:
raise e.to_synapse_error()

return result["displayname"]
return result.get("displayname")

async def set_displayname(
self,
Expand Down Expand Up @@ -246,7 +246,7 @@ async def get_avatar_url(self, target_user: UserID) -> Optional[str]:
except HttpResponseException as e:
raise e.to_synapse_error()

return result["avatar_url"]
return result.get("avatar_url")

async def set_avatar_url(
self,
Expand Down

0 comments on commit 0248409

Please sign in to comment.