mirror of
https://github.com/immich-app/immich.git
synced 2024-12-26 10:50:29 +02:00
feat(server): Allow .mkv, .wmv, .flv, .mpg videos to be uploaded. (#2045)
This commit is contained in:
parent
67453d18ff
commit
0616a66b05
@ -78,6 +78,30 @@ describe('assetUploadOption', () => {
|
|||||||
expect(callback).toHaveBeenCalledWith(null, true);
|
expect(callback).toHaveBeenCalledWith(null, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow .wmv videos', () => {
|
||||||
|
const file = { mimetype: 'video/x-ms-wmv', originalname: 'test.wmv' } as any;
|
||||||
|
fileFilter(mock.userRequest, file, callback);
|
||||||
|
expect(callback).toHaveBeenCalledWith(null, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow .mkv videos', () => {
|
||||||
|
const file = { mimetype: 'video/x-matroska', originalname: 'test.mkv' } as any;
|
||||||
|
fileFilter(mock.userRequest, file, callback);
|
||||||
|
expect(callback).toHaveBeenCalledWith(null, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow .mpg videos', () => {
|
||||||
|
const file = { mimetype: 'video/mpeg', originalname: 'test.mpg' } as any;
|
||||||
|
fileFilter(mock.userRequest, file, callback);
|
||||||
|
expect(callback).toHaveBeenCalledWith(null, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow .flv videos', () => {
|
||||||
|
const file = { mimetype: 'video/x-flv', originalname: 'test.flv' } as any;
|
||||||
|
fileFilter(mock.userRequest, file, callback);
|
||||||
|
expect(callback).toHaveBeenCalledWith(null, true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not allow unknown types', async () => {
|
it('should not allow unknown types', async () => {
|
||||||
const file = { mimetype: 'application/html', originalname: 'test.html' } as any;
|
const file = { mimetype: 'application/html', originalname: 'test.html' } as any;
|
||||||
const callback = jest.fn();
|
const callback = jest.fn();
|
||||||
|
@ -54,7 +54,7 @@ function fileFilter(req: Request, file: any, cb: any) {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
file.mimetype.match(
|
file.mimetype.match(
|
||||||
/\/(jpg|jpeg|png|gif|mp4|webm|x-msvideo|quicktime|heic|heif|dng|x-adobe-dng|webp|tiff|3gpp|nef|x-nikon-nef|x-fuji-raf|x-samsung-srw)$/,
|
/\/(jpg|jpeg|png|gif|mp4|webm|x-msvideo|quicktime|heic|heif|dng|x-adobe-dng|webp|tiff|3gpp|nef|x-nikon-nef|x-fuji-raf|x-samsung-srw|mpeg|x-flv|x-ms-wmv|x-matroska)$/,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
cb(null, true);
|
cb(null, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user