Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions langfuse/_task_manager/media_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,20 @@ def _process_upload_media_job(

return

headers = {"Content-Type": data["content_type"]}

# In self-hosted setups with GCP, do not add unsupported headers that fail the upload
is_self_hosted_gcs_bucket = "storage.googleapis.com" in upload_url

if not is_self_hosted_gcs_bucket:
headers["x-ms-blob-type"] = "BlockBlob"
headers["x-amz-checksum-sha256"] = data["content_sha256_hash"]

upload_start_time = time.time()
upload_response = self._request_with_backoff(
requests.put,
upload_url,
headers={
"Content-Type": data["content_type"],
"x-amz-checksum-sha256": data["content_sha256_hash"],
"x-ms-blob-type": "BlockBlob",
},
headers=headers,
data=data["content_bytes"],
)
upload_time_ms = int((time.time() - upload_start_time) * 1000)
Expand Down