[Glitch] Avoid storing audio and video file data in memory

Port f3d4db653c to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
lolsob-rspec
ThibG 2019-09-27 15:22:11 +02:00 committed by Thibaut Girka
parent c77eb90fa6
commit 82548d9403
1 changed files with 4 additions and 1 deletions

View File

@ -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());