User "Catrope" changed the status of MediaWiki.r95332.

Old Status: new
New Status: fixme

User "Catrope" also posted a comment on MediaWiki.r95332.

Full URL: 
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/95332#c21374
Commit summary:

* (bug 30441) getParamValue must understand "+" encoding of space

$.param() produces query string form encoding using the traditional '+' 
encoding for space; mediawiki.util.getParamValue() was using only 
decodeURIComponent() to do unescaping, which is not required by spec to handle 
'+'. Explicitly replacing '+' with '%20' before the decode nicely resolves this.

Added a test case to qunit tests for mediawiki.util module.

Comment:

<pre>
+                               return decodeURIComponent( m[1].replace( '+', 
'%20' ) );
</pre>
This doesn't work the way you expect. In JavaScript, <code>.replace()</code> 
only replaces the first occurrence, so:
<pre>
>>> url3 = 'example.com?' + $.param({ 'TEST': 'a b+c d+e' });
"example.com?TEST=a+b%2Bc+d%2Be"
>>> mw.util.getParamValue( 'TEST', url3 )
"a b+c+d+e"
</pre>
You'll need to use a regex with the g (global) modifier.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to