diff options
author | Erik Johnston <erik@matrix.org> | 2019-12-11 11:46:55 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-12-11 11:46:55 +0000 |
commit | 72acca6a32697a53f8f659e641d65dbf25ff6b4d (patch) | |
tree | f32768fa6b73ddcebda95b1b4cbe8f79da5fd151 /synapse/rest | |
parent | Merge branch 'erikj/fix_sqlite_7' of github.com:matrix-org/synapse into relea... (diff) | |
download | synapse-72acca6a32697a53f8f659e641d65dbf25ff6b4d.tar.xz |
Back out change preventing setting null avatar URLs
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/client/v1/profile.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/rest/client/v1/profile.py b/synapse/rest/client/v1/profile.py index 4f47562c1b..e7fe50ed72 100644 --- a/synapse/rest/client/v1/profile.py +++ b/synapse/rest/client/v1/profile.py @@ -15,6 +15,7 @@ """ This module contains REST servlets to do with profile: /profile/<paths> """ +from synapse.api.errors import Codes, SynapseError from synapse.http.servlet import RestServlet, parse_json_object_from_request from synapse.rest.client.v2_alpha._base import client_patterns from synapse.types import UserID @@ -103,12 +104,11 @@ class ProfileAvatarURLRestServlet(RestServlet): content = parse_json_object_from_request(request) try: - new_avatar_url = content.get("avatar_url") - except Exception: - return 400, "Unable to parse avatar_url" - - if new_avatar_url is None: - return 400, "Missing required key: avatar_url" + new_avatar_url = content["avatar_url"] + except KeyError: + raise SynapseError( + 400, "Missing key 'avatar_url'", errcode=Codes.MISSING_PARAM + ) await self.profile_handler.set_avatar_url( user, requester, new_avatar_url, is_admin |