mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-22 05:32:12 -03:00
fix(config): ensure symlink mappings are recorded before duplicate check
Update symlink traversal logic to always record path mappings before checking for visited directories. This prevents valid link->target pairs from being dropped when the target directory has already been visited via another path. Also correct path mapping lookup to properly replace link paths with their actual target paths.
This commit is contained in:
11
py/config.py
11
py/config.py
@@ -396,10 +396,13 @@ class Config:
|
||||
continue
|
||||
|
||||
normalized_target = self._normalize_path(target_path)
|
||||
# Always record the mapping even if we already visited
|
||||
# the real directory via another path. This prevents the
|
||||
# traversal order from dropping valid link->target pairs.
|
||||
self.add_path_mapping(entry_path, target_path)
|
||||
if normalized_target in visited_dirs:
|
||||
continue
|
||||
visited_dirs.add(normalized_target)
|
||||
self.add_path_mapping(entry_path, target_path)
|
||||
stack.append(target_path)
|
||||
continue
|
||||
|
||||
@@ -504,9 +507,9 @@ class Config:
|
||||
normalized_link = os.path.normpath(link_path).replace(os.sep, '/')
|
||||
# Check if the path is contained in any mapped target path
|
||||
for target_path, link_path in self._path_mappings.items():
|
||||
if normalized_link.startswith(target_path):
|
||||
# If the path starts with the target path, replace with actual path
|
||||
mapped_path = normalized_link.replace(target_path, link_path, 1)
|
||||
if normalized_link.startswith(link_path):
|
||||
# If the path starts with the link path, replace with actual path
|
||||
mapped_path = normalized_link.replace(link_path, target_path, 1)
|
||||
return mapped_path
|
||||
return link_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user