Fix: do not try deleting original that was moved to trash dir (#9684)

This commit is contained in:
shamoon 2025-04-19 15:11:29 -07:00 committed by GitHub
parent f52ebc7bf0
commit a57a3dbb30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -349,11 +349,15 @@ def cleanup_document_deletion(sender, instance, **kwargs):
) )
return return
for filename in ( files = (
instance.source_path,
instance.archive_path, instance.archive_path,
instance.thumbnail_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): if filename and os.path.isfile(filename):
try: try:
os.unlink(filename) os.unlink(filename)