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

Better errors regarding changing avatar_url #6497

Merged
merged 2 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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