File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -246,15 +246,20 @@ def _process_upload_media_job(
246
246
247
247
return
248
248
249
+ headers = {"Content-Type" : data ["content_type" ]}
250
+
251
+ # In self-hosted setups with GCP, do not add unsupported headers that fail the upload
252
+ is_self_hosted_gcs_bucket = "storage.googleapis.com" in upload_url
253
+
254
+ if not is_self_hosted_gcs_bucket :
255
+ headers ["x-ms-blob-type" ] = "BlockBlob"
256
+ headers ["x-amz-checksum-sha256" ] = data ["content_sha256_hash" ]
257
+
249
258
upload_start_time = time .time ()
250
259
upload_response = self ._request_with_backoff (
251
260
requests .put ,
252
261
upload_url ,
253
- headers = {
254
- "Content-Type" : data ["content_type" ],
255
- "x-amz-checksum-sha256" : data ["content_sha256_hash" ],
256
- "x-ms-blob-type" : "BlockBlob" ,
257
- },
262
+ headers = headers ,
258
263
data = data ["content_bytes" ],
259
264
)
260
265
upload_time_ms = int ((time .time () - upload_start_time ) * 1000 )
You can’t perform that action at this time.
0 commit comments