feat: 更新上传文件字段的schema,增加文件类型和大小限制,提升文件上传的有效性
This commit is contained in:
parent
583848e803
commit
7ab784eef6
|
|
@ -409,7 +409,13 @@ def _generate_field_schema(input_field: dict) -> dict:
|
|||
)
|
||||
elif field_type == "UploadFile":
|
||||
field_schema.update(
|
||||
{"type": "string", "format": "binary", "contentMediaType": "image/*", "description": "上传文件"}
|
||||
{
|
||||
"type": "string",
|
||||
"format": "binary",
|
||||
"contentMediaType": "image/*",
|
||||
"pattern": ".*\\.(jpg|jpeg|png)$",
|
||||
"description": "[ext:jpg,jpeg,png][file-size:1MB] 上传图片文件",
|
||||
}
|
||||
)
|
||||
else: # string
|
||||
field_schema.update({"type": "string"})
|
||||
|
|
|
|||
Loading…
Reference in New Issue