|
for name in dirs: |
|
shutil.rmtree(os.path.join(root, name)) |
|
except: |
|
return "Failed to unzip file", 400 |
The action of deleting extra stuff should probably be performed even if something failed in the process of unzipping the file and inserting images into the database. Besides, it seems, your os.walk above should fail with an exception if one of the directories from the tree is deleted while inside the walk...
By the way, can you completely avoid the action of fully unzipping the archive? Is it possible to, instead, go through files in the archive and, having the cheks performed, extract just the images one by one?
PicBrowser/interface/routes.py
Lines 100 to 103 in 27e0a4d
The action of deleting extra stuff should probably be performed even if something failed in the process of unzipping the file and inserting images into the database. Besides, it seems, your
os.walkabove should fail with an exception if one of the directories from the tree is deleted while inside the walk...By the way, can you completely avoid the action of fully unzipping the archive? Is it possible to, instead, go through files in the archive and, having the cheks performed, extract just the images one by one?