From 0c40a28ad368b98bfdce33365f1328347f1683b4 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Tue, 9 Feb 2021 19:46:59 +0100 Subject: [PATCH] more sanity checks regarding archive versions --- src/documents/sanity_checker.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/documents/sanity_checker.py b/src/documents/sanity_checker.py index 0b385e81b..61e927c82 100644 --- a/src/documents/sanity_checker.py +++ b/src/documents/sanity_checker.py @@ -87,6 +87,18 @@ def check_sanity(): f"Stored: {doc.checksum}, actual: {checksum}." )) + if doc.archive_checksum and not doc.archive_filename: + messages.append(SanityError( + f"Document {doc.pk} has an archive file checksum, but no " + f"archive filename." + )) + + if not doc.archive_checksum and doc.archive_filename: + messages.append(SanityError( + f"Document {doc.pk} has an archive file, but its checksum is " + f"missing." + )) + # Check sanity of the archive file. if doc.has_archive_version: if not os.path.isfile(doc.archive_path):