From 01f476ca1b4b1ccf56cc0d2b4953feb39c37471b Mon Sep 17 00:00:00 2001 From: sindoring Date: Sun, 19 Jul 2026 16:19:36 +0400 Subject: [PATCH] fix case-insensitive manifest merging --- upload_to_s3.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/upload_to_s3.py b/upload_to_s3.py index d66d540..d97d80f 100644 --- a/upload_to_s3.py +++ b/upload_to_s3.py @@ -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,