Skip to content

Commit 211bdb0

Browse files
Fix file upload for base64 encoded files (#1843)
Fixes #1825 Files can be encoded as bytes or base64 ([openapi docs](https://swagger.io/docs/specification/describing-request-body/file-upload/)), we were only handling bytes before.
1 parent 5de6dcc commit 211bdb0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

connexion/validators/form_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ async def _parse(self, stream: t.AsyncGenerator[bytes, None], scope: Scope) -> d
6161
value = data.getlist(key)
6262

6363
def is_file(schema):
64-
return (
65-
schema.get("type") == "string"
66-
and schema.get("format") == "binary"
67-
)
64+
return schema.get("type") == "string" and schema.get("format") in [
65+
"binary",
66+
"base64",
67+
]
6868

6969
# Single file upload
7070
if is_file(param_schema):

0 commit comments

Comments
 (0)