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

Commit

Permalink
Fix admin API for users when "avatar_url" is "null"
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
  • Loading branch information
awesome-manuel committed Feb 10, 2020
1 parent db0fee7 commit 26de7a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions synapse/rest/admin/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ async def on_PUT(self, request, user_id):
user_id, threepid["medium"], threepid["address"], current_time
)

if "avatar_url" in body:
if "avatar_url" in body and type(body["avatar_url"]) == str:
await self.profile_handler.set_avatar_url(
target_user, requester, body["avatar_url"], True
)
Expand Down Expand Up @@ -271,7 +271,7 @@ async def on_PUT(self, request, user_id):
user_id, threepid["medium"], threepid["address"], current_time
)

if "avatar_url" in body:
if "avatar_url" in body and type(body["avatar_url"]) == str:
await self.profile_handler.set_avatar_url(
user_id, requester, body["avatar_url"], True
)
Expand Down
1 change: 1 addition & 0 deletions tests/rest/admin/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ def test_requester_is_admin(self):
"password": "abc123",
"admin": True,
"threepids": [{"medium": "email", "address": "bob@bob.bob"}],
"avatar_url": None,
}
)

Expand Down

0 comments on commit 26de7a1

Please sign in to comment.