mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-08-25 18:32:35 +08:00
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:
@@ -44,7 +44,7 @@ from comfyui_version import __version__
|
||||
from app.frontend_management import FrontendManager, parse_version
|
||||
from comfy_api.internal import _ComfyNodeInternal
|
||||
from app.assets.seeder import asset_seeder
|
||||
from app.assets.api.routes import register_assets_routes
|
||||
from app.assets.api.routes import register_assets_routes, assets_enabled
|
||||
from app.assets.services.ingest import register_file_in_place
|
||||
from app.assets.services.path_utils import get_known_subfolder_tags
|
||||
from app.assets.services.asset_management import resolve_hash_to_path
|
||||
@@ -523,6 +523,12 @@ class PromptServer():
|
||||
# node preview, it constructs /view?filename=<asset_hash>, so this
|
||||
# endpoint must resolve blake3 hashes to their on-disk file paths.
|
||||
if filename.startswith("blake3:"):
|
||||
# Hash resolution requires the asset database. When assets
|
||||
# are disabled (--disable-assets) or unavailable (DB init
|
||||
# failure) the database was never initialized, so treat the
|
||||
# hash as unresolvable rather than erroring on a session.
|
||||
if not assets_enabled():
|
||||
return web.Response(status=404)
|
||||
owner_id = self.user_manager.get_request_user_id(request)
|
||||
result = resolve_hash_to_path(filename, owner_id=owner_id)
|
||||
if result is None:
|
||||
|
||||
Reference in New Issue
Block a user