Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
98ef3829
Kaydet (Commit)
98ef3829
authored
Eki 31, 2018
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29890 -- Fixed FileSystemStorage crash if concurrent saves try to create the same directory.
Regression in
632c4ffd
.
üst
3d4d0a25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
storage.py
django/core/files/storage.py
+2
-2
2.1.3.txt
docs/releases/2.1.3.txt
+4
-0
tests.py
tests/file_storage/tests.py
+4
-4
No files found.
django/core/files/storage.py
Dosyayı görüntüle @
98ef3829
...
@@ -240,9 +240,9 @@ class FileSystemStorage(Storage):
...
@@ -240,9 +240,9 @@ class FileSystemStorage(Storage):
os
.
umask
(
old_umask
)
os
.
umask
(
old_umask
)
else
:
else
:
os
.
makedirs
(
directory
)
os
.
makedirs
(
directory
)
except
File
NotFound
Error
:
except
File
Exists
Error
:
# There's a race between os.path.exists() and os.makedirs().
# There's a race between os.path.exists() and os.makedirs().
# If os.makedirs() fails with File
NotFound
Error, the directory
# If os.makedirs() fails with File
Exists
Error, the directory
# was created concurrently.
# was created concurrently.
pass
pass
if
not
os
.
path
.
isdir
(
directory
):
if
not
os
.
path
.
isdir
(
directory
):
...
...
docs/releases/2.1.3.txt
Dosyayı görüntüle @
98ef3829
...
@@ -20,3 +20,7 @@ Bugfixes
...
@@ -20,3 +20,7 @@ Bugfixes
* Fixed a regression where cached foreign keys that use ``to_field`` were
* Fixed a regression where cached foreign keys that use ``to_field`` were
incorrectly cleared in ``Model.save()`` (:ticket:`29896`).
incorrectly cleared in ``Model.save()`` (:ticket:`29896`).
* Fixed a regression in Django 2.0 where ``FileSystemStorage`` crashes with
``FileExistsError`` if concurrent saves try to create the same directory
(:ticket:`29890`).
tests/file_storage/tests.py
Dosyayı görüntüle @
98ef3829
...
@@ -415,9 +415,9 @@ class FileStorageTests(SimpleTestCase):
...
@@ -415,9 +415,9 @@ class FileStorageTests(SimpleTestCase):
real_makedirs
(
path
)
real_makedirs
(
path
)
elif
path
==
os
.
path
.
join
(
self
.
temp_dir
,
'raced'
):
elif
path
==
os
.
path
.
join
(
self
.
temp_dir
,
'raced'
):
real_makedirs
(
path
)
real_makedirs
(
path
)
raise
FileNotFoundError
()
elif
path
==
os
.
path
.
join
(
self
.
temp_dir
,
'error'
):
raise
FileExistsError
()
raise
FileExistsError
()
elif
path
==
os
.
path
.
join
(
self
.
temp_dir
,
'error'
):
raise
PermissionError
()
else
:
else
:
self
.
fail
(
'unexpected argument
%
r'
%
path
)
self
.
fail
(
'unexpected argument
%
r'
%
path
)
...
@@ -432,8 +432,8 @@ class FileStorageTests(SimpleTestCase):
...
@@ -432,8 +432,8 @@ class FileStorageTests(SimpleTestCase):
with
self
.
storage
.
open
(
'raced/test.file'
)
as
f
:
with
self
.
storage
.
open
(
'raced/test.file'
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
'saved with race'
)
self
.
assertEqual
(
f
.
read
(),
b
'saved with race'
)
# Exceptions aside from File
NotFound
Error are raised.
# Exceptions aside from File
Exists
Error are raised.
with
self
.
assertRaises
(
FileExists
Error
):
with
self
.
assertRaises
(
Permission
Error
):
self
.
storage
.
save
(
'error/test.file'
,
ContentFile
(
'not saved'
))
self
.
storage
.
save
(
'error/test.file'
,
ContentFile
(
'not saved'
))
finally
:
finally
:
os
.
makedirs
=
real_makedirs
os
.
makedirs
=
real_makedirs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment