finishUploadToStash could be called on an incomplete upload.
E.g. upload 1 chunk (that gets you the filekey) and then call
finishUploadToStash's finishUpload.
This adds another check for the stash result. The result will
only be 'Success' if all chunks have been submitted (or when
the file was uploaded as a whole, not chunked)
If we're still missing some chunks, result will be 'Continue'.
Bug: T190988
Change-Id: Ia0a4df0306b3e0cc0f2453f986b73bedd88241d3
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 );
}