r95815 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95814‎ | r95815 | r95816 >
Date:21:06, 30 August 2011
Author:raindrift
Status:ok
Tags:
Comment:
Disable internal regex checks when TitleBlacklist checking is enabled.
Fixes bug 30624
Modified paths:
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.validate.wmCommonsBlacklist.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/jquery/jquery.validate.wmCommonsBlacklist.js
@@ -1,7 +1,10 @@
22 /**
3 - * Does some local checking of a file. For more specific filenames (such as bad words, other blacklisted stuff) use
4 - * the Blacklist API.
 3+ * Does some local checking of a filename.
 4+ * If you want more specific filename checks (such as bad words, other blacklisted stuff) use the TitleBlacklist API.
55 *
 6+ * These checks are ignored when the TitleBlacklist API is available, since presumably they should be configured there instead, where it's
 7+ * possible to update them easily and higher-quality error messages are available.
 8+ *
69 * This is an incomplete rendering of some of the meta.wikimedia.org and commons.wikimedia.org blacklist as they existed on 2011-05-05, and
710 * ignores cases that are irrelevant to uploading new media images.
811 * - all regexes are case INsensitive by default
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -269,23 +269,33 @@
270270 _this.addDescription( true, mw.config.get( 'wgUserLanguage' ) );
271271 $j( containerDiv ).append( _this.div );
272272
273 - // make the title field required, and non-blacklisted
274 - _this.$form.find( '.mwe-title' )
275 - .rules( "add", {
276 - required: true,
277 - titleBadchars: true,
278 - titleSenselessimagename: true,
279 - titleThumbnail: true,
280 - titleExtension: true,
281 - messages: {
282 - required: gM( 'mwe-upwiz-error-blank' ),
283 - titleBadchars: gM( 'mwe-upwiz-error-title-badchars' ),
284 - titleSenselessimagename: gM( 'mwe-upwiz-error-title-senselessimagename' ),
285 - titleThumbnail: gM( 'mwe-upwiz-error-title-thumbnail' ),
286 - titleExtension: gM( 'mwe-upwiz-error-title-extension' )
287 - }
288 - } );
289 -
 273+ if( UploadWizardConfig.useTitleBlacklistApi ) {
 274+ // less strict checking, since TitleBlacklist checks should catch most errors.
 275+ _this.$form.find( '.mwe-title' )
 276+ .rules( "add", {
 277+ required: true,
 278+ messages: {
 279+ required: gM( 'mwe-upwiz-error-blank' ),
 280+ }
 281+ } );
 282+ } else {
 283+ // make the title field required, and non-blacklisted
 284+ _this.$form.find( '.mwe-title' )
 285+ .rules( "add", {
 286+ required: true,
 287+ titleBadchars: true,
 288+ titleSenselessimagename: true,
 289+ titleThumbnail: true,
 290+ titleExtension: true,
 291+ messages: {
 292+ required: gM( 'mwe-upwiz-error-blank' ),
 293+ titleBadchars: gM( 'mwe-upwiz-error-title-badchars' ),
 294+ titleSenselessimagename: gM( 'mwe-upwiz-error-title-senselessimagename' ),
 295+ titleThumbnail: gM( 'mwe-upwiz-error-title-thumbnail' ),
 296+ titleExtension: gM( 'mwe-upwiz-error-title-extension' )
 297+ }
 298+ } );
 299+ }
290300 // make this a category picker
291301 var hiddenCats = mw.isDefined( mw.UploadWizard.config.autoCategories ) ? mw.UploadWizard.config.autoCategories : [];
292302 if ( mw.isDefined( mw.UploadWizard.config.autoCategory ) && mw.UploadWizard.config.autoCategory !== '' ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r958871.17wmf1: MFT UploadWizard fixes r95691, r95726, r95727, r95793, r95815, r958...catrope17:10, 31 August 2011

Status & tagging log