~netlandish/django-wiki

e2fc45fc243ea38bf957adda86efa44c870b5a46 — Benjamin Bach 6 years ago 60c0589 + e18ef7e
Merge pull request #907 from officina/s3-storage-fix

S3 storage fix
1 files changed, 7 insertions(+), 0 deletions(-)

M src/wiki/plugins/images/models.py
M src/wiki/plugins/images/models.py => src/wiki/plugins/images/models.py +7 -0
@@ 107,8 107,15 @@ class ImageRevision(RevisionPluginRevision):
def on_image_revision_delete(instance, *args, **kwargs):
    if not instance.image:
        return

    # Remove image file
    instance.image.delete(save=False)
    
    try:
        path = instance.image.path.split("/")[:-1]
    except NotImplementedError:
            # This backend storage doesn't implement 'path' so there is no path to delete
        return

    try:
        path = instance.image.path.split("/")[:-1]