Skip to content

Commit

Permalink
Fix box edit avatar upload
Browse files Browse the repository at this point in the history
Box avatar upload was broken by moloch--#612
Also adjust the moloch--#617 fix by moving the validation call after the
posible un-tuple
  • Loading branch information
pluto00987 committed Sep 13, 2024
1 parent 0a2dba9 commit 7a064ce
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions models/Box.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,13 @@ def avatar(self):
@avatar.setter
def avatar(self, image_data):
avatar_path = "upload"
ext = avatar_validation(image_data)

if isinstance(image_data, tuple):
image_data, avatar_path = image_data
ext = avatar_validation(image_data)
if self.uuid is None:
self.uuid = str(uuid4())

if avatar_path == "upload":
os.path.join("upload", f"{self.uuid}.{ext}")

avatar_path = os.path.join(avatar_path, f"{self.uuid}.{ext}")
self._avatar = save_avatar(avatar_path, image_data)

@property
Expand Down

0 comments on commit 7a064ce

Please sign in to comment.