@@ -382,7 +382,14 @@ def to_simple_package_html(
382
382
out .append (' <body>' )
383
383
out .append (' <h1>Links for {}</h1>' .format (package_name .lower ().replace ("_" , "-" )))
384
384
for obj in sorted (self .gen_file_list (subdir , package_name )):
385
+
385
386
maybe_fragment = f"#sha256={ obj .checksum } " if obj .checksum else ""
387
+
388
+ # Temporary skip assigning sha256 to nightly index
389
+ # to be reverted on Jan 24, 2025.
390
+ if subdir is not None and "nightly" in subdir :
391
+ maybe_fragment = ""
392
+
386
393
pep658_attribute = ""
387
394
if obj .pep658 :
388
395
pep658_sha = f"sha256={ obj .pep658 } "
@@ -521,7 +528,6 @@ def fetch_object_names(cls: Type[S3IndexType], prefix: str) -> List[str]:
521
528
522
529
def fetch_metadata (self : S3IndexType ) -> None :
523
530
# Add PEP 503-compatible hashes to URLs to allow clients to avoid spurious downloads, if possible.
524
- regex_multipart_upload = r"^[A-Za-z0-9+/=]+=-[0-9]+$"
525
531
with concurrent .futures .ThreadPoolExecutor (max_workers = 6 ) as executor :
526
532
for idx , future in {
527
533
idx : executor .submit (
@@ -534,17 +540,10 @@ def fetch_metadata(self: S3IndexType) -> None:
534
540
if obj .size is None
535
541
}.items ():
536
542
response = future .result ()
537
- raw = response .get ("ChecksumSHA256" )
538
- if raw and match (regex_multipart_upload , raw ):
539
- # Possibly part of a multipart upload, making the checksum incorrect
540
- print (f"WARNING: { self .objects [idx ].orig_key } has bad checksum: { raw } " )
541
- raw = None
542
- sha256 = raw and base64 .b64decode (raw ).hex ()
543
+ sha256 = (_b64 := response .get ("ChecksumSHA256" )) and base64 .b64decode (_b64 ).hex ()
543
544
# For older files, rely on checksum-sha256 metadata that can be added to the file later
544
545
if sha256 is None :
545
546
sha256 = response .get ("Metadata" , {}).get ("checksum-sha256" )
546
- if sha256 is None :
547
- sha256 = response .get ("Metadata" , {}).get ("x-amz-meta-checksum-sha256" )
548
547
self .objects [idx ].checksum = sha256
549
548
if size := response .get ("ContentLength" ):
550
549
self .objects [idx ].size = int (size )
0 commit comments