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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user