from __future__ import annotations from pathlib import Path from .config import settings def resolve_thumb_path(stored_path: str | Path) -> Path: """Resolve a stored thumbnail path across host/container DATA_DIR changes.""" path = Path(stored_path) if path.is_file(): return path parts = path.parts try: thumbs_index = parts.index("thumbs") except ValueError: return path rebased = settings.data_dir.joinpath(*parts[thumbs_index:]) return rebased