Fixes an issue where the filename is not updated if the document is in the trash (but the file is moved)
This commit is contained in:
parent
ad23cce2e6
commit
41e4287f9e
@ -348,6 +348,8 @@ def cleanup_document_deletion(sender, instance, **kwargs):
|
|||||||
f"While deleting document {instance!s}, the file "
|
f"While deleting document {instance!s}, the file "
|
||||||
f"{filename} could not be deleted: {e}",
|
f"{filename} could not be deleted: {e}",
|
||||||
)
|
)
|
||||||
|
elif filename and not os.path.isfile(filename):
|
||||||
|
logger.warn(f"Expected {filename} tp exist, but it did not")
|
||||||
|
|
||||||
delete_empty_directories(
|
delete_empty_directories(
|
||||||
os.path.dirname(instance.source_path),
|
os.path.dirname(instance.source_path),
|
||||||
@ -461,7 +463,7 @@ def update_filename_and_move_files(
|
|||||||
shutil.move(old_archive_path, instance.archive_path)
|
shutil.move(old_archive_path, instance.archive_path)
|
||||||
|
|
||||||
# Don't save() here to prevent infinite recursion.
|
# Don't save() here to prevent infinite recursion.
|
||||||
Document.objects.filter(pk=instance.pk).update(
|
Document.global_objects.filter(pk=instance.pk).update(
|
||||||
filename=instance.filename,
|
filename=instance.filename,
|
||||||
archive_filename=instance.archive_filename,
|
archive_filename=instance.archive_filename,
|
||||||
modified=timezone.now(),
|
modified=timezone.now(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user