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:
committed by
Tim Graham
parent
ecb59cc657
commit
28bcff82c5
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user