about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-09-27 15:22:11 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-09-27 15:22:11 +0200
commit860a77d45ee9d17117364868f0932b4fcbe07d3d (patch)
tree258a8269b9291db9d3616ca2f76486bc708cffe9 /app
parent05ad7d606ca46afaa723745abba063e5d934b507 (diff)
Avoid storing audio and video file data in memory (#11974)
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/reducers/compose.js5
1 files changed, 4 insertions, 1 deletions
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());