fix(assets): don't hit uninitialized database from /view hash resolution

With --disable-assets (or after a database init failure) init_db() never
runs and Session stays None, but /view?filename=blake3:<hash> still
called resolve_hash_to_path(), raising TypeError and returning a 500.
Workflows saved while assets were enabled trigger this on preview render
in disabled mode. Gate the hash branch on live assets availability and
return 404, which also fixes the pre-existing 500 on the degraded path.

Also copy output_ui in the disabled enrichment fast path so the
'returns a new dict' contract holds in both modes.
This commit is contained in:
Simon Pinfold
2026-07-28 09:22:57 +12:00
parent b7c58c8371
commit 8da4669172
3 changed files with 14 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ def enrich_output_with_assets(output_ui: dict) -> dict:
"""
from comfy.cli_args import args
if args.disable_assets:
return output_ui
return dict(output_ui)
import folder_paths
from app.assets.services.ingest import register_file_in_place, DependencyMissingError