From bfcd3e6ff97c49c768d0b4c6303290b99207013a Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Thu, 11 Jan 2024 12:19:09 -0500 Subject: [PATCH] fix: mov files not being allowed on video upload (#792) --- src/files-and-videos/videos-page/data/utils.js | 12 ++++++++++-- src/files-and-videos/videos-page/data/utils.test.js | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/files-and-videos/videos-page/data/utils.js b/src/files-and-videos/videos-page/data/utils.js index a19c8fe1b6..1e5e7a5dc7 100644 --- a/src/files-and-videos/videos-page/data/utils.js +++ b/src/files-and-videos/videos-page/data/utils.js @@ -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); } }); diff --git a/src/files-and-videos/videos-page/data/utils.test.js b/src/files-and-videos/videos-page/data/utils.test.js index 2d3708a99d..54ca8dee0f 100644 --- a/src/files-and-videos/videos-page/data/utils.test.js +++ b/src/files-and-videos/videos-page/data/utils.test.js @@ -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); });