fix: mov files not being allowed on video upload (#792)
This commit is contained in:
@@ -110,11 +110,19 @@ export const getSupportedFormats = (supportedFileFormats) => {
|
||||
let format;
|
||||
if (isArray(value)) {
|
||||
value.forEach(val => {
|
||||
format = key.replace('*', val.substring(1));
|
||||
if (val === '.mov') {
|
||||
format = key.replace('*', 'quicktime');
|
||||
} else {
|
||||
format = key.replace('*', val.substring(1));
|
||||
}
|
||||
supportedFormats.push(format);
|
||||
});
|
||||
} else {
|
||||
format = key.replace('*', value?.substring(1));
|
||||
if (value === '.mov') {
|
||||
format = key.replace('*', 'quicktime');
|
||||
} else {
|
||||
format = key.replace('*', value.substring(1));
|
||||
}
|
||||
supportedFormats.push(format);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,8 +23,13 @@ describe('getSupportedFormats', () => {
|
||||
const actual = getSupportedFormats({ 'image/*': '.png' });
|
||||
expect(expected).toEqual(actual);
|
||||
});
|
||||
it('should return video/quicktime for .mov', () => {
|
||||
const expected = ['video/quicktime'];
|
||||
const actual = getSupportedFormats({ 'video/*': '.mov' });
|
||||
expect(expected).toEqual(actual);
|
||||
});
|
||||
it('should return array of valid file types', () => {
|
||||
const expected = ['video/mp4', 'video/mov'];
|
||||
const expected = ['video/mp4', 'video/quicktime'];
|
||||
const actual = getSupportedFormats({ 'video/*': ['.mp4', '.mov'] });
|
||||
expect(expected).toEqual(actual);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user