about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-09-27 15:22:11 +0200
committerThibaut Girka <thib@sitedethib.com>2019-09-30 15:58:29 +0200
commit0349c4d1cfd26b5d4c70990c0a1b7ddb9d6b6d60 (patch)
tree763ad3e3d32460d4375e20dbdc4e313ab3395688 /app/javascript/flavours
parent74af56b9cd269ce431b9fbfa85901e5bfe773161 (diff)
[Glitch] Avoid storing audio and video file data in memory
Port 860a77d45ee9d17117364868f0932b4fcbe07d3d to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js5
1 files changed, 4 insertions, 1 deletions
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());