Skip to content

Commit fe2398d

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
fix(closes OPEN-9006): multimodal feature not working in production with audio inputs
1 parent e054d4d commit fe2398d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/openlayer/lib/data/_upload.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def upload_bytes(
6767
data=data,
6868
object_name=object_name,
6969
content_type=content_type,
70-
fields=fields,
70+
fields=fields or {},
7171
)
7272
elif storage == StorageType.GCP:
7373
return upload_bytes_put(
@@ -115,9 +115,10 @@ def upload_bytes_multipart(
115115
if isinstance(data, bytes):
116116
data = io.BytesIO(data)
117117

118-
# fields can be None when using local storage (presigned URL has no S3 policy fields)
118+
# S3 requires the "file" field to be last in the multipart form.
119+
# Policy fields (key, policy, x-amz-credential, etc.) must come first.
119120
fields = fields or {}
120-
upload_fields = {"file": (object_name, data, content_type), **fields}
121+
upload_fields = {**fields, "file": (object_name, data, content_type)}
121122

122123
encoder = MultipartEncoder(fields=upload_fields)
123124
headers = {"Content-Type": encoder.content_type}

0 commit comments

Comments
 (0)