fix: correctly detect glb & gltf mimetypes during upload (#12623)
### What? The browser was incorrectly setting the mimetype for `.glb` and `.gltf` files to `application/octet-stream` when uploading when they should be receiving proper types consistent with `glb` and `gltf`. This patch adds logic to infer the correct `MIME` type for `.glb` files (`model/gltf-binary`) & `gltf` files (`model/gltf+json`) based on file extension during multipart processing, ensuring consistent MIME type detection regardless of browser behavior. Fixes #12620
This commit is contained in:
@@ -82,6 +82,7 @@ export interface Config {
|
||||
media: Media;
|
||||
'animated-type-media': AnimatedTypeMedia;
|
||||
enlarge: Enlarge;
|
||||
'without-enlarge': WithoutEnlarge;
|
||||
reduce: Reduce;
|
||||
'media-trim': MediaTrim;
|
||||
'custom-file-name-media': CustomFileNameMedia;
|
||||
@@ -103,6 +104,7 @@ export interface Config {
|
||||
'hide-file-input-on-create': HideFileInputOnCreate;
|
||||
'best-fit': BestFit;
|
||||
'list-view-preview': ListViewPreview;
|
||||
'three-dimensional': ThreeDimensional;
|
||||
users: User;
|
||||
'payload-locked-documents': PayloadLockedDocument;
|
||||
'payload-preferences': PayloadPreference;
|
||||
@@ -125,6 +127,7 @@ export interface Config {
|
||||
media: MediaSelect<false> | MediaSelect<true>;
|
||||
'animated-type-media': AnimatedTypeMediaSelect<false> | AnimatedTypeMediaSelect<true>;
|
||||
enlarge: EnlargeSelect<false> | EnlargeSelect<true>;
|
||||
'without-enlarge': WithoutEnlargeSelect<false> | WithoutEnlargeSelect<true>;
|
||||
reduce: ReduceSelect<false> | ReduceSelect<true>;
|
||||
'media-trim': MediaTrimSelect<false> | MediaTrimSelect<true>;
|
||||
'custom-file-name-media': CustomFileNameMediaSelect<false> | CustomFileNameMediaSelect<true>;
|
||||
@@ -146,6 +149,7 @@ export interface Config {
|
||||
'hide-file-input-on-create': HideFileInputOnCreateSelect<false> | HideFileInputOnCreateSelect<true>;
|
||||
'best-fit': BestFitSelect<false> | BestFitSelect<true>;
|
||||
'list-view-preview': ListViewPreviewSelect<false> | ListViewPreviewSelect<true>;
|
||||
'three-dimensional': ThreeDimensionalSelect<false> | ThreeDimensionalSelect<true>;
|
||||
users: UsersSelect<false> | UsersSelect<true>;
|
||||
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
||||
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
|
||||
@@ -848,6 +852,24 @@ export interface Enlarge {
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "without-enlarge".
|
||||
*/
|
||||
export interface WithoutEnlarge {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string | null;
|
||||
thumbnailURL?: string | null;
|
||||
filename?: string | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
focalX?: number | null;
|
||||
focalY?: number | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "reduce".
|
||||
@@ -1289,6 +1311,22 @@ export interface ListViewPreview {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "three-dimensional".
|
||||
*/
|
||||
export interface ThreeDimensional {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string | null;
|
||||
thumbnailURL?: string | null;
|
||||
filename?: string | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
@@ -1373,6 +1411,10 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'enlarge';
|
||||
value: string | Enlarge;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'without-enlarge';
|
||||
value: string | WithoutEnlarge;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'reduce';
|
||||
value: string | Reduce;
|
||||
@@ -1457,6 +1499,10 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'list-view-preview';
|
||||
value: string | ListViewPreview;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'three-dimensional';
|
||||
value: string | ThreeDimensional;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'users';
|
||||
value: string | User;
|
||||
@@ -2219,6 +2265,23 @@ export interface EnlargeSelect<T extends boolean = true> {
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "without-enlarge_select".
|
||||
*/
|
||||
export interface WithoutEnlargeSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
url?: T;
|
||||
thumbnailURL?: T;
|
||||
filename?: T;
|
||||
mimeType?: T;
|
||||
filesize?: T;
|
||||
width?: T;
|
||||
height?: T;
|
||||
focalX?: T;
|
||||
focalY?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "reduce_select".
|
||||
@@ -2692,6 +2755,21 @@ export interface ListViewPreviewSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "three-dimensional_select".
|
||||
*/
|
||||
export interface ThreeDimensionalSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
url?: T;
|
||||
thumbnailURL?: T;
|
||||
filename?: T;
|
||||
mimeType?: T;
|
||||
filesize?: T;
|
||||
width?: T;
|
||||
height?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users_select".
|
||||
|
||||
Reference in New Issue
Block a user