[FIX] Invalid MIME type when uploading audio files (#18426)

* Fix invalid mime type when uploading audio files

* Add migration.
pull/18457/head
Renato Becker 5 years ago committed by GitHub
parent 97f34ecf1e
commit b096e4975c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/ui/client/lib/recorderjs/audioEncoder.js
  2. 1
      server/startup/migrations/index.js
  3. 15
      server/startup/migrations/v202.js

@ -40,7 +40,7 @@ class AudioEncoder extends EventEmitter {
handleWorkerMessage = (event) => {
switch (event.data.command) {
case 'end': {
const blob = new Blob(event.data.buffer, { type: 'audio/mp3' });
const blob = new Blob(event.data.buffer, { type: 'audio/mpeg' });
this.emit('encoded', blob);
this.worker.terminate();
break;

@ -198,4 +198,5 @@ import './v198';
import './v199';
import './v200';
import './v201';
import './v202';
import './xrun';

@ -0,0 +1,15 @@
import { Migrations } from '../../../app/migrations/server';
import Uploads from '../../../app/models/server/models/Uploads';
Migrations.add({
version: 202,
up() {
Promise.await(Uploads.model.rawCollection().updateMany({
type: 'audio/mp3',
}, {
$set: {
type: 'audio/mpeg',
},
}));
},
});
Loading…
Cancel
Save