From 5f9c5f5dadb199da6c19bc3d753ad258bad7f9e7 Mon Sep 17 00:00:00 2001 From: halfaipg Date: Wed, 24 Sep 2025 21:34:35 -0400 Subject: [PATCH] Fix path parsing issue in _get_models function (#77) - Clean escaped characters and quotes from git ls-files output - Add safety check to skip non-existent files - Fixes FileNotFoundError when model paths contain escaped characters Resolves issue where comfy-pack API would fail with: FileNotFoundError: [Errno 2] No such file or directory: '.../models/loras/wan/wan\\WAN2.1_...' --- nodes/api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nodes/api.py b/nodes/api.py index 4430bc5..d2ec687 100644 --- a/nodes/api.py +++ b/nodes/api.py @@ -132,9 +132,9 @@ async def _get_models( models = [] model_filenames = [ - os.path.abspath(line) + os.path.abspath(line.strip().strip('"').replace('\\\\', '/')) for line in stdout.decode().splitlines() - if not os.path.basename(line).startswith(".") + if not os.path.basename(line.strip().strip('"').replace('\\\\', '/')).startswith(".") ] model_hashes = await async_batch_get_sha256( model_filenames, @@ -142,6 +142,10 @@ async def _get_models( ) for filename in model_filenames: + # Skip if file doesn't exist + if not os.path.exists(filename): + continue + relpath = os.path.relpath(filename, folder_paths.base_path) model_data = {