r84307 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84306‎ | r84307 | r84308 >
Date:03:59, 19 March 2011
Author:neilk
Status:deferred
Tags:
Comment:
fix bug 26108 - metadata error handler
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -228,10 +228,12 @@
229229 'siiprop': 'url'
230230 };
231231
232 - this.api.get( params, function( data ) {
 232+
 233+ var ok = function( data ) {
233234 if ( !data || !data.query || !data.query.stashimageinfo ) {
234235 mw.log("mw.UploadWizardUpload::getThumbnail> No data? ");
235236 callback( null );
 237+ return;
236238 }
237239 var thumbnails = data.query.stashimageinfo;
238240 for ( var i = 0; i < thumbnails.length; i++ ) {
@@ -239,6 +241,7 @@
240242 if ( ! ( thumb.thumburl && thumb.thumbwidth && thumb.thumbheight ) ) {
241243 mw.log( "mw.UploadWizardUpload::getThumbnail> thumbnail missing information" );
242244 callback( null );
 245+ return;
243246 }
244247 var image = document.createElement( 'img' );
245248 $j( image ).load( function() {
@@ -249,7 +252,14 @@
250253 image.src = thumb.thumburl;
251254 _this.thumbnails[key] = image;
252255 }
253 - } );
 256+ };
 257+
 258+ var err = function( code, result ) {
 259+ mw.log( 'mw.UploadWizardUpload::getThumbnail> error: ' + code, 'debug' );
 260+ callback( null );
 261+ };
 262+
 263+ this.api.get( params, { ok: ok, err: err } );
254264 }
255265 },
256266
@@ -272,7 +282,7 @@
273283 }
274284
275285 var callback = function( image ) {
276 - if ( image == null ) {
 286+ if ( image === null ) {
277287 $j( selector ).addClass( 'mwe-upwiz-file-preview-broken' );
278288 _this.ui.setStatus( 'mwe-upwiz-thumbnail-failed' );
279289 } else {

Status & tagging log