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.
This commit is contained in:
Robbe Sneyders
2024-02-13 23:52:24 +01:00
committed by GitHub
parent 5de6dccfbb
commit 211bdb03f6

View File

@@ -61,10 +61,10 @@ class FormDataValidator(AbstractRequestBodyValidator):
value = data.getlist(key) value = data.getlist(key)
def is_file(schema): def is_file(schema):
return ( return schema.get("type") == "string" and schema.get("format") in [
schema.get("type") == "string" "binary",
and schema.get("format") == "binary" "base64",
) ]
# Single file upload # Single file upload
if is_file(param_schema): if is_file(param_schema):