Merge branch 'dev' into feature-ocrmypdf

This commit is contained in:
jonaswinkler
2020-11-29 18:37:38 +01:00
11 changed files with 56 additions and 29 deletions

View File

@@ -224,7 +224,11 @@ def update_filename_and_move_files(sender, instance, **kwargs):
try:
os.rename(old_path, new_path)
instance.filename = new_filename
instance.save()
# Don't save here to prevent infinite recursion.
Document.objects.filter(pk=instance.pk).update(filename=new_filename)
logging.getLogger(__name__).debug(
f"Moved file {old_path} to {new_path}.")
except OSError as e:
instance.filename = old_filename