diff --git a/litecord/blueprints/users.py b/litecord/blueprints/users.py index 3e14a9b..c968aa6 100644 --- a/litecord/blueprints/users.py +++ b/litecord/blueprints/users.py @@ -173,7 +173,17 @@ async def patch_me(): """, j['email'], user_id) user['email'] = j['email'] - if 'avatar' in j and j['avatar']: + # only update if values are different + # from what the user gave. + + # this will return false if the client + # sends j['avatar'] as the user's + # original avatar hash, as they're the + # same. + + # IconManager.update will take care of validating + # the value once put()-ing + if to_update(j, user, 'avatar'): new_icon = await app.icons.update( 'user', user_id, j['avatar'], size=(128, 128)) diff --git a/litecord/schemas.py b/litecord/schemas.py index e1ddeb2..8d72005 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -191,7 +191,8 @@ USER_UPDATE = { }, 'avatar': { - 'type': 'b64_icon', 'required': False, + # can be both b64_icon or string (just the hash) + 'type': 'string', 'required': False, 'nullable': True },