}
} );
tokenPromise.done( function () {
- $form.submit();
+ $form.trigger( 'submit' );
} );
} );
file.name = 'file';
- // eslint-disable-next-line jquery/no-each-util
+ // eslint-disable-next-line no-jquery/no-each-util
$.each( data, function ( key, val ) {
$form.append( getHiddenInput( key, val ) );
} );
}
// If the call flat out failed, we may want to try again...
- retry = api.uploadChunk.bind( this, file, data, start, end, filekey, retries - 1 );
+ retry = api.uploadChunk.bind( api, file, data, start, end, filekey, retries - 1 );
return api.retry( code, result, retry );
},
function ( fraction ) {
return finishUpload;
},
function ( errorCode, result ) {
- if ( result && result.upload && result.upload.filekey ) {
- // Ignore any warnings if 'filekey' was returned, that's all we care about
+ if ( result && result.upload && result.upload.result === 'Success' && result.upload.filekey ) {
+ // Catch handler is also called in case of warnings (e.g. 'duplicate')
+ // We don't really care about those warnings, as long as the upload got stashed...
filekey = result.upload.filekey;
return $.Deferred().resolve( finishUpload );
}