Skip to content

Commit 2a7cf50

Browse files
committed
Fixed image upload check for primary
1 parent fbc5f96 commit 2a7cf50

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

backend/PyMatcha/routes/api/profile/images.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def add_image_profile():
2929
raise BadRequestError("No file passed in request")
3030
if file:
3131
if is_primary:
32-
try:
33-
Image.get_multi(user_id=current_user.id, is_primary=True)
34-
except ValueError:
32+
if not Image.get_multi(user_id=current_user.id, is_primary=True):
3533
# That means there was no primary image before
3634
tmp_img = BytesIO()
3735
file.save(tmp_img)

0 commit comments

Comments
 (0)