From 0349c4d1cfd26b5d4c70990c0a1b7ddb9d6b6d60 Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 27 Sep 2019 15:22:11 +0200 Subject: [Glitch] Avoid storing audio and video file data in memory Port 860a77d45ee9d17117364868f0932b4fcbe07d3d to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/reducers/compose.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/javascript/flavours/glitch/reducers/compose.js') diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index 3699ec1ad..17ce5de3c 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -194,7 +194,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()); -- cgit