feat(attachments): scan enumerates all; import_file maps 'attached' + member ML

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 11:14:49 -04:00
parent f97551e2f6
commit 89103c4570
4 changed files with 75 additions and 16 deletions
+15 -6
View File
@@ -11,7 +11,20 @@ from sqlalchemy.orm import sessionmaker
from ..celery_app import celery
from ..config import get_config
from ..models import ImportBatch, ImportSettings, ImportTask
from ..services.importer import is_supported
def _iter_import_files(import_root: Path):
"""Every regular file except sidecar .json, dotfiles, and .partial
temp files. The Importer dispatches by kind (media / archive /
other) — scan no longer filters to media (FC-2d-iii)."""
for entry in import_root.rglob("*"):
if not entry.is_file():
continue
if entry.name.startswith("."):
continue
if entry.suffix.lower() in (".json", ".partial"):
continue
yield entry
def _sync_session_factory():
@@ -42,11 +55,7 @@ def scan_directory(self, triggered_by: str = "manual") -> int:
# Walk and enumerate.
files_seen = 0
for entry in import_root.rglob("*"):
if not entry.is_file():
continue
if not is_supported(entry):
continue
for entry in _iter_import_files(import_root):
try:
size = entry.stat().st_size
except OSError: