]> git.lizzy.rs Git - cheatdb.git/commitdiff
Ignore FileExistsError in thumbnails
authorrubenwardy <rw@rubenwardy.com>
Fri, 10 Jul 2020 19:50:25 +0000 (20:50 +0100)
committerrubenwardy <rw@rubenwardy.com>
Fri, 10 Jul 2020 19:50:25 +0000 (20:50 +0100)
app/blueprints/thumbnails/__init__.py

index dbfdfc5fd699946579ca5eba4664e1298e78a308..ef995029584c82a3d5aefdb9230d0b8cdf6508f8 100644 (file)
@@ -26,8 +26,11 @@ ALLOWED_RESOLUTIONS=[(100,67), (270,180), (350,233)]
 
 def mkdir(path):
        assert path != "" and path is not None
-       if not os.path.isdir(path):
-               os.mkdir(path)
+       try:
+               if not os.path.isdir(path):
+                       os.mkdir(path)
+       except FileExistsError:
+               pass
 
 
 def resize_and_crop(img_path, modified_path, size):