fix: enhance MXF handling in mime-types utility

* Updated video mime type validation to include 'application/mxf'.
* Adjusted asset type determination to recognize MXF as a video container.
pull/24644/head
timonrieger 2025-12-17 14:46:10 +01:00
parent 9765538255
commit 5316bcf588
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -189,7 +189,7 @@ describe('mimeTypes', () => {
it('should contain only video mime types', () => {
const values = Object.values(mimeTypes.video).flat();
expect(values).toEqual(values.filter((mimeType) => mimeType.startsWith('video/')));
expect(values).toEqual(values.filter((mimeType) => mimeType.startsWith('video/') || mimeType === 'application/mxf'));
});
for (const [extension, v] of Object.entries(mimeTypes.video)) {

View File

@ -134,6 +134,14 @@ export const mimeTypes = {
/** return an extension (including a leading `.`) for a mime-type */
toExtension,
assetType: (filename: string) => {
// Check file extension first to handle cases like MXF (application/mxf) that are video containers
if (isType(filename, video)) {
return AssetType.Video;
}
if (isType(filename, image)) {
return AssetType.Image;
}
// Fallback to mime type check for any edge cases
const contentType = lookup(filename);
if (contentType.startsWith('image/')) {
return AssetType.Image;