From 6c1bbbcf160a92d5100986f7194de73610694ef0 Mon Sep 17 00:00:00 2001 From: Luke Mino-Altherr Date: Tue, 24 Feb 2026 17:12:53 -0800 Subject: [PATCH] Exclude hidden files and custom_nodes folder from asset scanning - Filter hidden files/directories (dot-prefixed) in collect_models_files() using is_visible(), matching the existing behavior for input/output roots - Exclude the 'custom_nodes' folder name from get_comfy_models_folders(); custom nodes that register their own paths under other folder names will still be scanned as expected Amp-Thread-ID: https://ampcode.com/threads/T-019c924b-591a-725e-b8b7-0d49ba1a5591 Co-authored-by: Amp --- app/assets/scanner.py | 3 +++ app/assets/services/path_utils.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/assets/scanner.py b/app/assets/scanner.py index 85c77dfa4..260cf9711 100644 --- a/app/assets/scanner.py +++ b/app/assets/scanner.py @@ -28,6 +28,7 @@ from app.assets.services.bulk_ingest import ( ) from app.assets.services.file_utils import ( get_mtime_ns, + is_visible, list_files_recursively, verify_file_unchanged, ) @@ -84,6 +85,8 @@ def collect_models_files() -> list[str]: for folder_name, bases in get_comfy_models_folders(): rel_files = folder_paths.get_filename_list(folder_name) or [] for rel_path in rel_files: + if not all(is_visible(part) for part in Path(rel_path).parts): + continue abs_path = folder_paths.get_full_path(folder_name, rel_path) if not abs_path: continue diff --git a/app/assets/services/path_utils.py b/app/assets/services/path_utils.py index 22be7b18b..f10229af9 100644 --- a/app/assets/services/path_utils.py +++ b/app/assets/services/path_utils.py @@ -7,14 +7,20 @@ from app.assets.database.queries import list_references_by_asset_id from app.assets.helpers import normalize_tags, select_best_live_path +_NON_MODEL_FOLDER_NAMES = frozenset({"custom_nodes"}) + + def get_comfy_models_folders() -> list[tuple[str, list[str]]]: """Build list of (folder_name, base_paths[]) for all model locations. Includes every category registered in folder_names_and_paths, - regardless of whether its paths are under the main models_dir. + regardless of whether its paths are under the main models_dir, + but excludes non-model entries like custom_nodes. """ targets: list[tuple[str, list[str]]] = [] for name, values in folder_paths.folder_names_and_paths.items(): + if name in _NON_MODEL_FOLDER_NAMES: + continue paths, _exts = values[0], values[1] if paths: targets.append((name, paths))