fix: 2MB size limit on profile picture upload
This commit is contained in:
parent
cc4c09fd0d
commit
a265c0bd19
@ -56,7 +56,7 @@ class MyProfileViewSet(viewsets.ModelViewSet):
|
||||
def perform_update(self, serializer, pk=None):
|
||||
profile: ProfileModel = self.get_object()
|
||||
avatar = self.request.data.get("file", None)
|
||||
if (avatar is not None):
|
||||
if (avatar is not None and avatar.size <= 2 * 1024 * 1024):
|
||||
if (profile.avatar_url.name != "./profiles/static/avatars/default.avif"):
|
||||
profile.avatar_url.storage.delete(profile.avatar_url.name)
|
||||
profile.avatar_url = avatar
|
||||
|
Loading…
Reference in New Issue
Block a user