fix case-insensitive manifest merging
This commit is contained in:
+8
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user