http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95451
Revision: 95451 Author: brion Date: 2011-08-24 22:09:34 +0000 (Wed, 24 Aug 2011) Log Message: ----------- Followup r95332 (bug 30441 fix) -- Roan pointed out that I forgot to do a global replace (d'oh!) Now works with parameters containing multiple spaces. :) Modified Paths: -------------- trunk/phase3/resources/mediawiki/mediawiki.util.js trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js Modified: trunk/phase3/resources/mediawiki/mediawiki.util.js =================================================================== --- trunk/phase3/resources/mediawiki/mediawiki.util.js 2011-08-24 21:55:11 UTC (rev 95450) +++ trunk/phase3/resources/mediawiki/mediawiki.util.js 2011-08-24 22:09:34 UTC (rev 95451) @@ -228,7 +228,7 @@ if ( m && m.length > 1 ) { // Beware that decodeURIComponent is not required to understand '+' // by spec, as encodeURIComponent does not produce it. - return decodeURIComponent( m[1].replace( '+', '%20' ) ); + return decodeURIComponent( m[1].replace( /\+/g, '%20' ) ); } return null; }, Modified: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js =================================================================== --- trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js 2011-08-24 21:55:11 UTC (rev 95450) +++ trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js 2011-08-24 22:09:34 UTC (rev 95451) @@ -107,7 +107,7 @@ }); test( 'getParamValue', function() { - expect(4); + expect(5); var url1 = 'http://mediawiki.org/?foo=wrong&foo=right#&foo=bad'; @@ -119,6 +119,9 @@ var url3 = 'example.com?' + $.param({ 'TEST': 'a b+c' }); strictEqual( mw.util.getParamValue( 'TEST', url3 ), 'a b+c', 'Bug 30441: getParamValue must understand "+" encoding of space' ); + + var url4 = 'example.com?' + $.param({ 'TEST': 'a b+c d' }); // check for sloppy code from r95332 :) + strictEqual( mw.util.getParamValue( 'TEST', url4 ), 'a b+c d', 'Bug 30441: getParamValue must understand "+" encoding of space (multiple spaces)' ); }); test( 'tooltipAccessKey', function() { _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs