fix case-insensitive manifest merging

This commit is contained in:
2026-07-19 16:19:36 +04:00
parent 63c9af7846
commit 01f476ca1b
+8 -3
View File
@@ -23,15 +23,20 @@ def compute_build_hash(files: list[dict]) -> str:
return hashlib.sha256("\n".join(lines).encode("utf-8")).hexdigest()
def normalized_path_key(path: str) -> str:
"""Match client paths using Windows filesystem semantics."""
return path.replace("\\", "/").casefold()
def merge_manifests(base_manifest: dict, staging_manifest: dict) -> dict:
files_by_path = {
item["path"]: item
normalized_path_key(item["path"]): item
for item in base_manifest.get("files", [])
}
for item in staging_manifest.get("files", []):
files_by_path[item["path"]] = item
files_by_path[normalized_path_key(item["path"])] = item
files = [files_by_path[path] for path in sorted(files_by_path)]
files = sorted(files_by_path.values(), key=lambda item: item["path"].casefold())
return {
"buildHash": compute_build_hash(files),
"files": files,