Fix: dont try deleting original that was moved to trash dir

This commit is contained in:
shamoon
2025-04-16 08:26:43 -07:00
parent 67a97ffc4d
commit 88343cabba

View File

@@ -349,11 +349,15 @@ def cleanup_document_deletion(sender, instance, **kwargs):
)
return
for filename in (
instance.source_path,
files = (
instance.archive_path,
instance.thumbnail_path,
):
)
if not settings.EMPTY_TRASH_DIR:
# Only delete the original file if we are not moving it to trash dir
files += (instance.source_path,)
for filename in files:
if filename and os.path.isfile(filename):
try:
os.unlink(filename)