Skip to content

Commit 51189da

Browse files
committed
Use backwards compatible implementation
1 parent a625c7f commit 51189da

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

‎dandi/files/zarr.py‎

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
ZARR_DELETE_BATCH_SIZE,
2828
ZARR_MIME_TYPE,
2929
ZARR_UPLOAD_BATCH_SIZE,
30-
EmbargoStatus,
3130
)
3231
from dandi.dandiapi import (
3332
RemoteAsset,
@@ -915,18 +914,28 @@ def _upload_zarr_file(
915914
headers = {"Content-MD5": item.base64_digest}
916915
if item.content_type is not None:
917916
headers["Content-Type"] = item.content_type
918-
if dandiset.embargo_status == EmbargoStatus.EMBARGOED:
919-
# Technically, a header can be specified more than once. Join all together just in case.
920-
signed_headers = ";".join(
921-
urllib.parse.parse_qs(upload_url).get("X-Amz-SignedHeaders", [])
922-
).split(";")
923-
# Check that the tagging header is present, and error if not. If not present, it will
924-
# error either way, but error from AWS would be much less specific and hard to decipher
925-
if "x-amz-tagging" not in signed_headers:
926-
raise ValueError(
927-
"'x-amz-tagging' header not included in embargoed pre-signed URL"
928-
)
929917

918+
# TODO: Replace below implementation with this once LINC and EMBER
919+
# update their API to match dandi-archive >= 0.12.14
920+
# if dandiset.embargo_status == EmbargoStatus.EMBARGOED:
921+
# # Technically, a header can be specified more than once.
922+
# # Join all together just in case.
923+
# signed_headers = ";".join(
924+
# urllib.parse.parse_qs(upload_url).get("X-Amz-SignedHeaders", [])
925+
# ).split(";")
926+
# # Check that the tagging header is present, and error if not. If not present, it will
927+
# # error either way, but error from AWS would be much less specific
928+
# # and hard to decipher
929+
# if "x-amz-tagging" not in signed_headers:
930+
# raise ValueError(
931+
# "'x-amz-tagging' header not included in embargoed pre-signed URL"
932+
# )
933+
934+
# Technically, a header can be specified more than once. Join all together just in case.
935+
signed_headers = ";".join(
936+
urllib.parse.parse_qs(upload_url).get("X-Amz-SignedHeaders", [])
937+
).split(";")
938+
if "x-amz-tagging" in signed_headers:
930939
headers["x-amz-tagging"] = "embargoed=true"
931940

932941
with item.filepath.open("rb") as fp:

0 commit comments

Comments
 (0)