Skip to content

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

Adjusted the sanity checker so that it takes archived documents into account.

jonaswinkler5b020bb8d28d
diff --git a/src/documents/sanity_checker.py b/src/documents/sanity_checker.py
index 18bb3781c..706a2cd03 100644
--- a/src/documents/sanity_checker.py
+++ b/src/documents/sanity_checker.py
@@ -81,6 +81,17 @@ def check_sanity():
f"Stored: {doc.checksum}, actual: {checksum}."
))
+ if os.path.isfile(doc.archive_path):
+ try:
+ with doc.archive_file as f:
+ f.read()
+ except OSError as e:
+ messages.append(SanityError(
+ f"Cannot read archive file of document {doc.pk}: {e}"
+ ))
+
+ present_files.remove(os.path.normpath(doc.archive_path))
+
if not doc.content:
messages.append(SanityWarning(
f"Document {doc.pk} has no content."