mirror of
https://github.com/immich-app/immich.git
synced 2026-07-16 05:34:30 +03:00
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.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user