From 9c7efff3b9310b6642fd4d7a5fc9456544ced8b8 Mon Sep 17 00:00:00 2001 From: Andrea Maschio Date: Sun, 10 Jun 2018 23:24:39 +0200 Subject: [PATCH] fix for s3 storage unimplemented path method --- src/wiki/plugins/images/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wiki/plugins/images/models.py b/src/wiki/plugins/images/models.py index a594eb02..49ddbcce 100644 --- a/src/wiki/plugins/images/models.py +++ b/src/wiki/plugins/images/models.py @@ -107,9 +107,14 @@ class ImageRevision(RevisionPluginRevision): def on_image_revision_delete(instance, *args, **kwargs): if not instance.image: return - # Remove image file - path = instance.image.path.split("/")[:-1] + # Remove image file instance.image.delete(save=False) + + try: + path = instance.image.path.split("/")[:-1] + except NotImplemented: + # This backend storage doesn't implement 'path' so there is no path to delete + return # Clean up empty directories -- 2.45.2