From: ThibG Date: Fri, 27 Sep 2019 13:22:11 +0000 (+0200) Subject: Avoid storing audio and video file data in memory (#11974) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=860a77d45ee9d17117364868f0932b4fcbe07d3d;p=mastodon.git Avoid storing audio and video file data in memory (#11974) --- diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 5798f529d..b5dc81703 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -107,7 +107,10 @@ function appendMedia(state, media, file) { const prevSize = state.get('media_attachments').size; 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('resetFileKey', Math.floor((Math.random() * 0x10000))); map.set('idempotencyKey', uuid());