summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-12-09 14:54:33 +0000
committerGitHub <noreply@github.com>2019-12-09 14:54:33 +0000
commit5e8abe9013427e8ad452c4652dfcb40da05c246e (patch)
treea354359636e037ebfc57d666c1819beea023b74b
parentBack out perf regression from get_cross_signing_keys_from_cache. (#6494) (diff)
downloadsynapse-5e8abe9013427e8ad452c4652dfcb40da05c246e.tar.xz
Better errors regarding changing avatar_url (#6497)
-rw-r--r--changelog.d/6497.bugfix1
-rw-r--r--synapse/rest/client/v1/profile.py11
2 files changed, 9 insertions, 3 deletions
diff --git a/changelog.d/6497.bugfix b/changelog.d/6497.bugfix
new file mode 100644

index 0000000000..92ed08fc40 --- /dev/null +++ b/changelog.d/6497.bugfix
@@ -0,0 +1 @@ +Fix error message when setting your profile's avatar URL mentioning displaynames, and prevent NoneType avatar_urls. \ No newline at end of file diff --git a/synapse/rest/client/v1/profile.py b/synapse/rest/client/v1/profile.py
index 1eac8a44c5..4f47562c1b 100644 --- a/synapse/rest/client/v1/profile.py +++ b/synapse/rest/client/v1/profile.py
@@ -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" + + 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, {}