r109837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109836‎ | r109837 | r109838 >
Date:18:11, 23 January 2012
Author:hartman
Status:ok (Comments)
Tags:needs-js-test 
Comment:
Correct mw.Uri.decode to properly decode encoded + signs. Fixes bug 33902
Patch by Fomafix
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.Uri.js (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -233,6 +233,7 @@
234234 a null edit.
235235 * (bug 33880) $wgUsersNotifiedOnAllChanges should not send e-mail to user who made
236236 the edit.
 237+* (bug 33902) Decoding %2B with mw.Uri.decode results in ' ' instead of +
237238
238239 === API changes in 1.19 ===
239240 * Made action=edit less likely to return "unknownerror", by returning the actual error
Index: trunk/phase3/resources/mediawiki/mediawiki.Uri.js
@@ -160,7 +160,7 @@
161161 * @return {String} decoded string
162162 */
163163 Uri.decode = function( s ) {
164 - return decodeURIComponent( s ).replace( /\+/g, ' ' );
 164+ return decodeURIComponent( s.replace( /\+/g, '%20' ) );
165165 };
166166
167167 Uri.prototype = {

Comments

#Comment by Nikerabbit (talk | contribs)   18:12, 23 January 2012

No tests??

#Comment by Krinkle (talk | contribs)   00:52, 30 January 2012

Please add unit tests to mediawiki.Uri.spec.js.

#Comment by TheDJ (talk | contribs)   21:11, 6 February 2012

That is a jasmine test ? Can someone point me at the README for jasmine tests, because they don't do jack for me atm. how do I use/create/test them ?

#Comment by TheDJ (talk | contribs)   22:24, 6 February 2012

Hmm.. .isn't it a bit weird that we have this encode in the first place ? It doesn't seem as if we do any encoding/decoding for any of the other parts of the mw.Uri.... makes it a bit inconsistent.

Status & tagging log