mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 08:15:27 +01:00
Catch exception during trash-move
This commit is contained in:
parent
335b8c63e0
commit
a7e1c1c4d0
1 changed files with 8 additions and 1 deletions
|
|
@ -247,7 +247,14 @@ def cleanup_document_deletion(sender, instance, using, **kwargs):
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Moving {instance.source_path} to trash at {new_file_path}")
|
f"Moving {instance.source_path} to trash at {new_file_path}")
|
||||||
os.rename(instance.source_path, new_file_path)
|
try:
|
||||||
|
os.rename(instance.source_path, new_file_path)
|
||||||
|
except OSError as e:
|
||||||
|
logger.error(
|
||||||
|
f"Failed to move {instance.source_path} to trash at "
|
||||||
|
f"{new_file_path}: {e}. Skipping cleanup!"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
for filename in (instance.source_path,
|
for filename in (instance.source_path,
|
||||||
instance.archive_path,
|
instance.archive_path,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue