mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-10-06 01:56:14 -05:00
Enhancement: ignore same files in sanity checker as consumer
This commit is contained in:
@@ -76,7 +76,9 @@ def check_sanity(*, progress=False, scheduled=True) -> SanityCheckMessages:
|
||||
messages = SanityCheckMessages()
|
||||
|
||||
present_files = {
|
||||
x.resolve() for x in Path(settings.MEDIA_ROOT).glob("**/*") if not x.is_dir()
|
||||
x.resolve()
|
||||
for x in Path(settings.MEDIA_ROOT).glob("**/*")
|
||||
if not x.is_dir() and x.name not in settings.IGNORABLE_FILES
|
||||
}
|
||||
|
||||
lockfile = Path(settings.MEDIA_LOCK).resolve()
|
||||
|
@@ -169,6 +169,13 @@ class TestSanityCheck(DirectoriesMixin, TestCase):
|
||||
messages = check_sanity()
|
||||
self.assertFalse(messages.has_warning)
|
||||
|
||||
def test_ignore_ignorable_files(self):
|
||||
self.make_test_data()
|
||||
Path(self.dirs.media_dir, ".DS_Store").touch()
|
||||
Path(self.dirs.media_dir, "desktop.ini").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
|
||||
|
@@ -1003,6 +1003,18 @@ THREADS_PER_WORKER = os.getenv(
|
||||
# Paperless Specific Settings #
|
||||
###############################################################################
|
||||
|
||||
IGNORABLE_FILES: Final[list[str]] = [
|
||||
".DS_Store",
|
||||
".DS_STORE",
|
||||
"._*",
|
||||
".stfolder/*",
|
||||
".stversions/*",
|
||||
".localized/*",
|
||||
"desktop.ini",
|
||||
"@eaDir/*",
|
||||
"Thumbs.db",
|
||||
]
|
||||
|
||||
CONSUMER_POLLING = int(os.getenv("PAPERLESS_CONSUMER_POLLING", 0))
|
||||
|
||||
CONSUMER_POLLING_DELAY = int(os.getenv("PAPERLESS_CONSUMER_POLLING_DELAY", 5))
|
||||
@@ -1025,7 +1037,7 @@ CONSUMER_IGNORE_PATTERNS = list(
|
||||
json.loads(
|
||||
os.getenv(
|
||||
"PAPERLESS_CONSUMER_IGNORE_PATTERNS",
|
||||
'[".DS_Store", ".DS_STORE", "._*", ".stfolder/*", ".stversions/*", ".localized/*", "desktop.ini", "@eaDir/*", "Thumbs.db"]',
|
||||
json.dumps(IGNORABLE_FILES),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
Reference in New Issue
Block a user