b731a88beb
The CLI download flow only set civitai_model_id/version_id on local_files without caching the full model payload, so 'tsr db list' joined against empty models/versions/creators tables and showed every linked file as 'unlinked'. The server's _auto_link_file path had additional bugs: resolved-vs-unresolved path comparison after rescan, redundant CivitAI hash lookup, and silent failure swallowed by 'completed' status. - New Database.register_downloaded_file() consolidates hashing, metadata storage, FK linking, and cache_model() into a single idempotent call shared by both CLI and server paths. - Server _do_download now passes version_info straight through and surfaces db_file_id/db_linked/db_cached/db_error onto _active_downloads. - Drops the broken _auto_link_file rescan helper.