fix(assets): normalize file_path separators to forward slashes on Windows

get_asset_category_and_relative_path returned os.path.relpath output
directly, which uses backslashes on Windows, producing logical paths like
'LLM\model.safetensors'. Normalize to '/' so the logical file_path is
platform-independent, matching _compute_relative. Fixes test_path_utils
failures on windows-2022.
This commit is contained in:
Matt Miller 2026-06-08 19:04:33 -07:00
parent dbe4b19563
commit 0e6d281157

View File

@ -211,7 +211,10 @@ def get_asset_category_and_relative_path(
return root, rel
combined = os.path.join(folder_name, rel)
return root, os.path.relpath(os.path.join(os.sep, combined), os.sep)
normalized = os.path.relpath(os.path.join(os.sep, combined), os.sep)
# Normalize to forward slashes so the logical path is identical across
# platforms (os.path.relpath emits backslashes on Windows).
return root, normalized.replace(os.sep, "/")
def get_name_and_tags_from_asset_path(file_path: str) -> tuple[str, list[str]]: