mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-19 12:42:14 -05:00
Fix: ignore logo file from sanity checker (#9946)
This commit is contained in:
parent
3365fc92fd
commit
6647b32ac0
@ -82,6 +82,11 @@ def check_sanity(*, progress=False, scheduled=True) -> SanityCheckMessages:
|
|||||||
if lockfile in present_files:
|
if lockfile in present_files:
|
||||||
present_files.remove(lockfile)
|
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):
|
for doc in tqdm(Document.global_objects.all(), disable=not progress):
|
||||||
# Check sanity of the thumbnail
|
# Check sanity of the thumbnail
|
||||||
thumbnail_path: Final[Path] = Path(doc.thumbnail_path).resolve()
|
thumbnail_path: Final[Path] = Path(doc.thumbnail_path).resolve()
|
||||||
|
@ -5,6 +5,7 @@ from pathlib import Path
|
|||||||
import filelock
|
import filelock
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from django.test import override_settings
|
||||||
|
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from documents.sanity_checker import check_sanity
|
from documents.sanity_checker import check_sanity
|
||||||
@ -157,6 +158,17 @@ class TestSanityCheck(DirectoriesMixin, TestCase):
|
|||||||
"Orphaned file in media dir",
|
"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):
|
def test_archive_filename_no_checksum(self):
|
||||||
doc = self.make_test_data()
|
doc = self.make_test_data()
|
||||||
doc.archive_checksum = None
|
doc.archive_checksum = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user