mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: Improve folder filtering logic to ensure exact matches and handle root folder case
This commit is contained in:
@@ -142,10 +142,18 @@ class BaseModelService(ABC):
|
|||||||
if folder is not None:
|
if folder is not None:
|
||||||
if search_options and search_options.get('recursive', True):
|
if search_options and search_options.get('recursive', True):
|
||||||
# Recursive folder filtering - include all subfolders
|
# Recursive folder filtering - include all subfolders
|
||||||
data = [
|
# Ensure we match exact folder or its subfolders by checking path boundaries
|
||||||
item for item in data
|
if folder == "":
|
||||||
if item['folder'].startswith(folder)
|
# Empty folder means root - include all items
|
||||||
]
|
pass # Don't filter anything
|
||||||
|
else:
|
||||||
|
# Add trailing slash to ensure we match folder boundaries correctly
|
||||||
|
folder_with_separator = folder + "/"
|
||||||
|
data = [
|
||||||
|
item for item in data
|
||||||
|
if (item['folder'] == folder or
|
||||||
|
item['folder'].startswith(folder_with_separator))
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
# Exact folder filtering
|
# Exact folder filtering
|
||||||
data = [
|
data = [
|
||||||
|
|||||||
Reference in New Issue
Block a user