File tree Expand file tree Collapse file tree
app/javascript/mastodon/actions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,8 +203,8 @@ export function uploadCompose(files) {
203203 return function ( dispatch , getState ) {
204204 const uploadLimit = 4 ;
205205 const media = getState ( ) . getIn ( [ 'compose' , 'media_attachments' ] ) ;
206- const total = Array . from ( files ) . reduce ( ( a , v ) => a + v . size , 0 ) ;
207206 const progress = new Array ( files . length ) . fill ( 0 ) ;
207+ let total = Array . from ( files ) . reduce ( ( a , v ) => a + v . size , 0 ) ;
208208
209209 if ( files . length + media . size > uploadLimit ) {
210210 dispatch ( showAlert ( undefined , messages . uploadErrorLimit ) ) ;
@@ -224,6 +224,8 @@ export function uploadCompose(files) {
224224 resizeImage ( f ) . then ( file => {
225225 const data = new FormData ( ) ;
226226 data . append ( 'file' , file ) ;
227+ // Account for disparity in size of original image and resized data
228+ total += file . size - f . size ;
227229
228230 return api ( getState ) . post ( '/api/v1/media' , data , {
229231 onUploadProgress : function ( { loaded } ) {
You can’t perform that action at this time.
0 commit comments