@@ -21,7 +21,7 @@ def _metadata(spec_hash: Optional[str], temporary: Optional[bool] = False):
2121
2222 return metadata or None
2323
24- def upload_to_s3 (file_path : Path , bucket_name : str , folder_name : str , temporary : bool = False ):
24+ def upload_to_s3 (file_path : Path , bucket_name : str , folder_name : str , spec_hash : str , temporary : bool = False ):
2525 """
2626 Upload a file to S3 with:
2727 - ACL bucket-owner-full-control
@@ -33,8 +33,8 @@ def upload_to_s3(file_path: Path, bucket_name: str, folder_name: str, temporary:
3333 key = f"apis/{ folder_name } /{ file_path } "
3434
3535 # --- Compute MD5 Hash for Metadata ---
36- spec_json = file_path .read_text (encoding = "utf-8" )
37- spec_hash = hashlib .md5 (spec_json .encode ("utf-8" )).hexdigest ()
36+ # spec_json = file_path.read_text(encoding="utf-8")
37+ # spec_hash = hashlib.md5(spec_json.encode("utf-8")).hexdigest()
3838
3939 # Build complete metadata
4040 metadata = _metadata (spec_hash = spec_hash , temporary = temporary )
@@ -81,7 +81,11 @@ def main(bucket_name: str, repo_name: str):
8181
8282 print (dst_json_file )
8383
84- upload_to_s3 ("spec.json" , bucket_name , repo_name )
84+ spec_hash = hashlib .md5 (dst_json_file .read_text (encoding = "utf-8" ).encode ("utf-8" )).hexdigest ()
85+
86+ print (f"Computed MD5 hash: { spec_hash } " )
87+
88+ upload_to_s3 ("spec.json" , bucket_name , repo_name , spec_hash )
8589
8690 print ("[DONE] Processing complete." )
8791 return 0
0 commit comments