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

Commit

Permalink
Better errors regarding changing avatar_url (#6497)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Dec 9, 2019
1 parent adfdd82 commit 5e8abe9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/6497.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error message when setting your profile's avatar URL mentioning displaynames, and prevent NoneType avatar_urls.
11 changes: 8 additions & 3 deletions synapse/rest/client/v1/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ async def on_PUT(self, request, user_id):

content = parse_json_object_from_request(request)
try:
new_name = content["avatar_url"]
new_avatar_url = content.get("avatar_url")
except Exception:
return 400, "Unable to parse name"
return 400, "Unable to parse avatar_url"

if new_avatar_url is None:
return 400, "Missing required key: avatar_url"

await self.profile_handler.set_avatar_url(user, requester, new_name, is_admin)
await self.profile_handler.set_avatar_url(
user, requester, new_avatar_url, is_admin
)

return 200, {}

Expand Down

0 comments on commit 5e8abe9

Please sign in to comment.