1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Fixed #26297 -- Fixed collectstatic --clear crash if storage doesn't implement path().

This commit is contained in:
Berker Peksag
2016-03-14 05:17:05 +02:00
committed by Tim Graham
parent ecb59cc657
commit 28bcff82c5
4 changed files with 54 additions and 5 deletions

View File

@@ -221,12 +221,16 @@ class Command(BaseCommand):
smart_text(fpath), level=1)
else:
self.log("Deleting '%s'" % smart_text(fpath), level=1)
full_path = self.storage.path(fpath)
if not os.path.exists(full_path) and os.path.lexists(full_path):
# Delete broken symlinks
os.unlink(full_path)
else:
try:
full_path = self.storage.path(fpath)
except NotImplementedError:
self.storage.delete(fpath)
else:
if not os.path.exists(full_path) and os.path.lexists(full_path):
# Delete broken symlinks
os.unlink(full_path)
else:
self.storage.delete(fpath)
for d in dirs:
self.clear_dir(os.path.join(path, d))