|
27 | 27 | ZARR_DELETE_BATCH_SIZE, |
28 | 28 | ZARR_MIME_TYPE, |
29 | 29 | ZARR_UPLOAD_BATCH_SIZE, |
30 | | - EmbargoStatus, |
31 | 30 | ) |
32 | 31 | from dandi.dandiapi import ( |
33 | 32 | RemoteAsset, |
@@ -915,18 +914,28 @@ def _upload_zarr_file( |
915 | 914 | headers = {"Content-MD5": item.base64_digest} |
916 | 915 | if item.content_type is not None: |
917 | 916 | 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 | | - ) |
929 | 917 |
|
| 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: |
930 | 939 | headers["x-amz-tagging"] = "embargoed=true" |
931 | 940 |
|
932 | 941 | with item.filepath.open("rb") as fp: |
|
0 commit comments