From d531c66bf024d80bf95f3cf4acccb1f34dbcc736 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 28 Sep 2020 14:22:09 -0700 Subject: [PATCH] Delete photo's thumbnail when deleting the file. A minor oversight, I think you'll agree. --- etiquette/objects.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index ea239cf..05530aa 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -821,8 +821,17 @@ class Photo(ObjectBase): else: self.photodb.log.debug('Deleting %s', path) action = os.remove - queue_action = {'action': action, 'args': [path]} - self.photodb.on_commit_queue.append(queue_action) + + self.photodb.on_commit_queue.append({ + 'action': action, + 'args': [path], + }) + if self.thumbnail and self.thumbnail.is_file: + self.photodb.on_commit_queue.append({ + 'action': action, + 'args': [self.thumbnail.absolute_path], + }) + self._uncache() self.deleted = True