Better errors regarding changing avatar_url (#6497)
This commit is contained in:
parent
adfdd82b21
commit
5e8abe9013
|
@ -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)
|
||||
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"
|
||||
|
||||
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, {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue