mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-11 12:09:27 -05:00
Fix: do not try deleting original that was moved to trash dir (#9684)
This commit is contained in:
parent
f52ebc7bf0
commit
a57a3dbb30
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user