fix(ui): ensure file field is only serialized at top-level for upload-enabled collections (#12074)
This fixes an issue where fields with the name `file` was being serialized as a top-level field in multipart form data even when the collection was not upload-enabled. This caused the value of `file` (when used as a regular field like a text, array, etc.) to be stripped from the `_payload`. - Updated `createFormData` to only delete `data.file` and serialize it at the top level if `docConfig.upload` is defined. - This prevents unintended loss of `file` field values for non-upload collections. The `file` field now remains safely nested in `_payload` unless it's part of an upload-enabled collection.
This commit is contained in:
@@ -247,6 +247,7 @@ export interface Post {
|
||||
sidebarField?: string | null;
|
||||
wavelengths?: ('fm' | 'am') | null;
|
||||
selectField?: ('option1' | 'option2')[] | null;
|
||||
file?: string | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
_status?: ('draft' | 'published') | null;
|
||||
@@ -665,6 +666,7 @@ export interface PostsSelect<T extends boolean = true> {
|
||||
sidebarField?: T;
|
||||
wavelengths?: T;
|
||||
selectField?: T;
|
||||
file?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
_status?: T;
|
||||
|
||||
Reference in New Issue
Block a user