A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: ignore logo file from sanity checker (#9946)
shamoon6647b32ac06f
diff --git a/src/documents/sanity_checker.py b/src/documents/sanity_checker.pyindex 6cef98f1a..4f7abde06 100644--- a/src/documents/sanity_checker.py+++ b/src/documents/sanity_checker.py@@ -82,6 +82,11 @@ def check_sanity(*, progress=False, scheduled=True) -> SanityCheckMessages:if lockfile in present_files:present_files.remove(lockfile)+ if settings.APP_LOGO:+ logo_file = Path(settings.MEDIA_ROOT / settings.APP_LOGO).resolve()+ if logo_file in present_files:+ present_files.remove(logo_file)+for doc in tqdm(Document.global_objects.all(), disable=not progress):# Check sanity of the thumbnailthumbnail_path: Final[Path] = Path(doc.thumbnail_path).resolve()diff --git a/src/documents/tests/test_sanity_check.py b/src/documents/tests/test_sanity_check.pyindex 0dec2d53b..c33062c42 100644--- a/src/documents/tests/test_sanity_check.py+++ b/src/documents/tests/test_sanity_check.py@@ -5,6 +5,7 @@ from pathlib import Pathimport filelockfrom django.conf import settingsfrom django.test import TestCase+from django.test import override_settingsfrom documents.models import Documentfrom documents.sanity_checker import check_sanity@@ -157,6 +158,17 @@ class TestSanityCheck(DirectoriesMixin, TestCase):"Orphaned file in media dir",)+ @override_settings(+ APP_LOGO="logo/logo.png",+ )+ def test_ignore_logo(self):+ self.make_test_data()+ logo_dir = Path(self.dirs.media_dir, "logo")+ logo_dir.mkdir(parents=True, exist_ok=True)+ Path(self.dirs.media_dir, "logo", "logo.png").touch()+ messages = check_sanity()+ self.assertFalse(messages.has_warning)+def test_archive_filename_no_checksum(self):doc = self.make_test_data()doc.archive_checksum = None