]> cat aescling's git repositories - mastodon.git/commitdiff
Avoid storing audio and video file data in memory (#11974)
authorThibG <thib@sitedethib.com>
Fri, 27 Sep 2019 13:22:11 +0000 (15:22 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 27 Sep 2019 13:22:11 +0000 (15:22 +0200)
app/javascript/mastodon/reducers/compose.js

index 5798f529dc30d6f5d61700697859e2c12d0dafa0..b5dc81703d156f670a08c9e0a1bb8eeb8f612f8d 100644 (file)
@@ -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());