mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复InputFile组件的请求体中包含empty值的问题 (#2625)
This commit is contained in:
parent
608b86f4c0
commit
e1c9f44fa5
@ -356,12 +356,11 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
if (value && value instanceof Blob) {
|
||||
files = [value as any];
|
||||
} else if (value) {
|
||||
files = (
|
||||
Array.isArray(value)
|
||||
? value
|
||||
: joinValues
|
||||
? `${(value as any)[valueField] || value}`.split(delimiter)
|
||||
: [value as any]
|
||||
files = (Array.isArray(value)
|
||||
? value
|
||||
: joinValues
|
||||
? `${(value as any)[valueField] || value}`.split(delimiter)
|
||||
: [value as any]
|
||||
)
|
||||
.map(item => FileControl.valueToFile(item, props) as FileValue)
|
||||
.filter(item => item);
|
||||
@ -403,12 +402,11 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
let files: Array<FileValue> = [];
|
||||
|
||||
if (value) {
|
||||
files = (
|
||||
Array.isArray(value)
|
||||
? value
|
||||
: joinValues && typeof value === 'string'
|
||||
? value.split(delimiter)
|
||||
: [value as any]
|
||||
files = (Array.isArray(value)
|
||||
? value
|
||||
: joinValues && typeof value === 'string'
|
||||
? value.split(delimiter)
|
||||
: [value as any]
|
||||
)
|
||||
.map(item => {
|
||||
let obj = FileControl.valueToFile(
|
||||
@ -884,6 +882,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
|
||||
qsstringify({...api.data, ...params})
|
||||
.split('&')
|
||||
.filter(i => !!i)
|
||||
.forEach(item => {
|
||||
const parts = item.split('=');
|
||||
fd.append(parts[0], decodeURIComponent(parts[1]));
|
||||
|
Loading…
Reference in New Issue
Block a user