forked from MirrorHub/synapse
Better errors regarding changing avatar_url (#6497)
This commit is contained in:
parent
adfdd82b21
commit
5e8abe9013
2 changed files with 9 additions and 3 deletions
1
changelog.d/6497.bugfix
Normal file
1
changelog.d/6497.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix error message when setting your profile's avatar URL mentioning displaynames, and prevent NoneType avatar_urls.
|
|
@ -103,11 +103,16 @@ class ProfileAvatarURLRestServlet(RestServlet):
|
||||||
|
|
||||||
content = parse_json_object_from_request(request)
|
content = parse_json_object_from_request(request)
|
||||||
try:
|
try:
|
||||||
new_name = content["avatar_url"]
|
new_avatar_url = content.get("avatar_url")
|
||||||
except Exception:
|
except Exception:
|
||||||
return 400, "Unable to parse name"
|
return 400, "Unable to parse avatar_url"
|
||||||
|
|
||||||
await self.profile_handler.set_avatar_url(user, requester, new_name, is_admin)
|
if new_avatar_url is None:
|
||||||
|
return 400, "Missing required key: avatar_url"
|
||||||
|
|
||||||
|
await self.profile_handler.set_avatar_url(
|
||||||
|
user, requester, new_avatar_url, is_admin
|
||||||
|
)
|
||||||
|
|
||||||
return 200, {}
|
return 200, {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue