🐛 Only delete images if there are images to delete (smart, right?)

This commit is contained in:
Mawoka
2022-04-07 17:16:13 +02:00
parent 3279196cc3
commit 8c472327f4
+2 -1
View File
@@ -125,5 +125,6 @@ async def delete_quiz(quiz_id: str, user: User = Depends(get_current_user)):
pics_to_delete.append(pic_name_regex.match(question["image"]).group(1))
except KeyError:
pass
await storage.delete(pics_to_delete)
if len(pics_to_delete) != 0:
await storage.delete(pics_to_delete)
return await quiz.delete()