Merge "i18n: Drop img-auth-nologinnWL, unused AFAICT"
[lhc/web/wiklou.git] / resources / src / mediawiki.api / upload.js
index de0688a..fe21f07 100644 (file)
                                        }
 
                                        // 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 );
                                        }