Parcourir la source

Avoid storing audio and video file data in memory (#11974)

master^2
ThibG il y a 4 ans
committed by Eugen Rochko
Parent
révision
860a77d45e
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. +4
    -1
      app/javascript/mastodon/reducers/compose.js

+ 4
- 1
app/javascript/mastodon/reducers/compose.js Voir le fichier

@@ -107,7 +107,10 @@ function appendMedia(state, media, file) {
const prevSize = state.get('media_attachments').size; const prevSize = state.get('media_attachments').size;


return state.withMutations(map => { return state.withMutations(map => {
map.update('media_attachments', list => list.push(media.set('file', file)));
if (media.get('type') === 'image') {
media = media.set('file', file);
}
map.update('media_attachments', list => list.push(media));
map.set('is_uploading', false); map.set('is_uploading', false);
map.set('resetFileKey', Math.floor((Math.random() * 0x10000))); map.set('resetFileKey', Math.floor((Math.random() * 0x10000)));
map.set('idempotencyKey', uuid()); map.set('idempotencyKey', uuid());


Chargement…
Annuler
Enregistrer