mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
feat: remove path separator normalization for cross-platform compatibility
Removed the forced normalization of path separators to forward slashes in BaseModelService to maintain platform-specific separators. Updated test cases to use os.sep for constructing expected paths, ensuring tests work correctly across different operating systems while preserving native path representations.
This commit is contained in:
@@ -716,8 +716,6 @@ class BaseModelService(ABC):
|
|||||||
if normalized_file.startswith(normalized_root):
|
if normalized_file.startswith(normalized_root):
|
||||||
# Remove root and leading separator to get relative path
|
# Remove root and leading separator to get relative path
|
||||||
relative_path = normalized_file[len(normalized_root):].lstrip(os.sep)
|
relative_path = normalized_file[len(normalized_root):].lstrip(os.sep)
|
||||||
# Normalize separators so results are stable across platforms
|
|
||||||
relative_path = relative_path.replace(os.sep, "/")
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if not relative_path:
|
if not relative_path:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from py.services.base_model_service import BaseModelService
|
from py.services.base_model_service import BaseModelService
|
||||||
@@ -42,8 +43,8 @@ async def test_search_relative_paths_supports_multiple_tokens():
|
|||||||
matching = await service.search_relative_paths("flux detail")
|
matching = await service.search_relative_paths("flux detail")
|
||||||
|
|
||||||
assert matching == [
|
assert matching == [
|
||||||
"flux/detail-model.safetensors",
|
f"flux{os.sep}detail-model.safetensors",
|
||||||
"detail/flux-trained.safetensors",
|
f"detail{os.sep}flux-trained.safetensors",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -60,4 +61,4 @@ async def test_search_relative_paths_excludes_tokens():
|
|||||||
|
|
||||||
matching = await service.search_relative_paths("flux -detail")
|
matching = await service.search_relative_paths("flux -detail")
|
||||||
|
|
||||||
assert matching == ["flux/keep-me.safetensors"]
|
assert matching == [f"flux{os.sep}keep-me.safetensors"]
|
||||||
|
|||||||
Reference in New Issue
Block a user