r95451 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95450‎ | r95451 | r95452 >
Date:22:09, 24 August 2011
Author:brion
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
@@ -107,7 +107,7 @@
108108 });
109109
110110 test( 'getParamValue', function() {
111 - expect(4);
 111+ expect(5);
112112
113113 var url1 = 'http://mediawiki.org/?foo=wrong&foo=right#&foo=bad';
114114
@@ -119,6 +119,9 @@
120120
121121 var url3 = 'example.com?' + $.param({ 'TEST': 'a b+c' });
122122 strictEqual( mw.util.getParamValue( 'TEST', url3 ), 'a b+c', 'Bug 30441: getParamValue must understand "+" encoding of space' );
 123+
 124+ var url4 = 'example.com?' + $.param({ 'TEST': 'a b+c d' }); // check for sloppy code from r95332 :)
 125+ strictEqual( mw.util.getParamValue( 'TEST', url4 ), 'a b+c d', 'Bug 30441: getParamValue must understand "+" encoding of space (multiple spaces)' );
123126 });
124127
125128 test( 'tooltipAccessKey', function() {
Index: trunk/phase3/resources/mediawiki/mediawiki.util.js
@@ -228,7 +228,7 @@
229229 if ( m && m.length > 1 ) {
230230 // Beware that decodeURIComponent is not required to understand '+'
231231 // by spec, as encodeURIComponent does not produce it.
232 - return decodeURIComponent( m[1].replace( '+', '%20' ) );
 232+ return decodeURIComponent( m[1].replace( /\+/g, '%20' ) );
233233 }
234234 return null;
235235 },

Follow-up revisions

RevisionCommit summaryAuthorDate
r96088MFT to REL1_18...hashar10:53, 2 September 2011
r964661.17wmf1: MFT r95332, r95451catrope18:39, 7 September 2011
r96559MFT r92422, r93520, r93563, r94107, r94433, r95042, r95332, r95451, r96386...reedy12:49, 8 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95332* (bug 30441) getParamValue must understand "+" encoding of space...brion20:17, 23 August 2011

Status & tagging log