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:
+ return decodeURIComponent( m[1].replace( '+',
'%20' ) );
This doesn't work the way you expect. In JavaScript, .replace()
only replaces the first occurrence, so:
>>> 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"
You'll need to use a regex with the g (global) modifier.
___
MediaWiki-CodeReview mailing list
mediawiki-coderev...@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview