1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #29890 -- Fixed FileSystemStorage crash if concurrent saves try to create the same directory.

Regression in 632c4ffd9c.
This commit is contained in:
Tim Graham
2018-10-31 19:25:53 -04:00
parent 3d4d0a25b2
commit 98ef3829e9
3 changed files with 10 additions and 6 deletions

View File

@@ -240,9 +240,9 @@ class FileSystemStorage(Storage):
os.umask(old_umask)
else:
os.makedirs(directory)
except FileNotFoundError:
except FileExistsError:
# There's a race between os.path.exists() and os.makedirs().
# If os.makedirs() fails with FileNotFoundError, the directory
# If os.makedirs() fails with FileExistsError, the directory
# was created concurrently.
pass
if not os.path.isdir(directory):