Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

only move files if necessary

jonaswinklerd90080f325f0
diff --git a/src/documents/migrations/1012_fix_archive_files.py b/src/documents/migrations/1012_fix_archive_files.py
index e95715265..98794aad0 100644
--- a/src/documents/migrations/1012_fix_archive_files.py
+++ b/src/documents/migrations/1012_fix_archive_files.py
@@ -163,8 +163,9 @@ def move_new_to_old_locations(apps, schema_editor):
for doc in Document.objects.filter(archive_checksum__isnull=False):
new_archive_path = archive_path_new(doc)
old_archive_path = archive_path_old(doc)
- shutil.move(new_archive_path, old_archive_path)
- logger.debug(f"Moving {new_archive_path} to {old_archive_path}")
+ if new_archive_path != old_archive_path:
+ logger.debug(f"Moving {new_archive_path} to {old_archive_path}")
+ shutil.move(new_archive_path, old_archive_path)
class Migration(migrations.Migration):