diff --git a/core/shared/config/overrides.json b/core/shared/config/overrides.json index d840e76545..23707449cd 100644 --- a/core/shared/config/overrides.json +++ b/core/shared/config/overrides.json @@ -31,8 +31,8 @@ "contentTypes": ["image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/x-icon", "image/vnd.microsoft.icon", "image/webp"] }, "media": { - "extensions": [".mp4",".webm", ".ogv"], - "contentTypes": ["video/mp4", "video/webm", "video/ogg"] + "extensions": [".mp4",".webm", ".ogv", ".mp3", ".wav"], + "contentTypes": ["video/mp4", "video/webm", "video/ogg", "audio/mpeg", "audio/vnd.wav"] }, "thumbnails": { "extensions": [".jpg", ".jpeg", ".gif", ".png", ".svg", ".svgz", ".ico", ".webp"], diff --git a/test/e2e-api/admin/media.test.js b/test/e2e-api/admin/media.test.js index d3414f21ec..2451a71a92 100644 --- a/test/e2e-api/admin/media.test.js +++ b/test/e2e-api/admin/media.test.js @@ -74,6 +74,20 @@ describe('Media API', function () { media.push(res.body.media[0].url.replace(config.get('url'), '')); }); + it('Can upload an mp3', async function () { + const res = await request.post(localUtils.API.getApiQuery('media/upload')) + .set('Origin', config.get('url')) + .expect('Content-Type', /json/) + .field('ref', 'audio_file_123') + .attach('file', path.join(__dirname, '/../../utils/fixtures/media/sample.mp3')) + .expect(201); + + res.body.media[0].url.should.match(new RegExp(`${config.get('url')}/content/media/\\d+/\\d+/sample.mp3`)); + res.body.media[0].ref.should.equal('audio_file_123'); + + media.push(res.body.media[0].url.replace(config.get('url'), '')); + }); + it('Rejects non-media file type', async function () { const res = await request.post(localUtils.API.getApiQuery('media/upload')) .set('Origin', config.get('url')) diff --git a/test/utils/fixtures/media/sample.mp3 b/test/utils/fixtures/media/sample.mp3 new file mode 100644 index 0000000000..1a7e2be3d7 Binary files /dev/null and b/test/utils/fixtures/media/sample.mp3 differ