r87772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87771‎ | r87772 | r87773 >
Date:21:06, 9 May 2011
Author:neilk
Status:ok
Tags:
Comment:
followup to r87410 -- trap errors for mw.Title properly
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -676,8 +676,16 @@
677677 }
678678 if ( mw.isDefined( mw.UploadWizard.config['altUploadForm'] ) && mw.UploadWizard.config['altUploadForm'] !== '' ) {
679679 // altUploadForm is expected to be a page title like 'Commons:Upload', so convert to URL
680 - var altUploadFormUrl = ( new mw.Title( mw.UploadWizard.config['altUploadForm'] ) ).getUrl();
681 - $j( '#contentSub' ).append( $j( '<span class="contentSubLink"></span>' ).msg( 'mwe-upwiz-subhead-alt-upload', $j( '<a></a>' ).attr( { href: altUploadFormUrl } ) ) );
 680+ var title;
 681+ try {
 682+ title = new mw.Title( mw.UploadWizard.config['altUploadForm'] );
 683+ } catch ( e ) {
 684+ // page was empty, or impossible on this wiki (missing namespace or some other issue). Give up.
 685+ }
 686+ if ( title instanceof mw.Title ) {
 687+ var altUploadFormUrl = title.getUrl();
 688+ $j( '#contentSub' ).append( $j( '<span class="contentSubLink"></span>' ).msg( 'mwe-upwiz-subhead-alt-upload', $j( '<a></a>' ).attr( { href: altUploadFormUrl } ) ) );
 689+ }
682690 }
683691 $j( '#contentSub .contentSubLink:not(:last)' ).after( '&nbsp;&middot;&nbsp;' );
684692

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87410obtain URL from page title of alternate upload formneilk16:34, 4 May 2011

Status & tagging log