ApiSandbox: Convert all pluses in URL to spaces, not just the first one
authorMatt Russell <public@matt-russell.com>
Thu, 25 Feb 2016 07:19:38 +0000 (18:19 +1100)
committerAnomie <bjorsch@wikimedia.org>
Thu, 25 Feb 2016 13:28:20 +0000 (13:28 +0000)
This would prevent linking to any query that contains spaces.

Change-Id: I45607c1eb465d4d9bf7bbb1de7098bb1450b5043
Bug: T128053

resources/src/mediawiki.special/mediawiki.special.apisandbox.js

index bd1cad6..06d1538 100644 (file)
 
                        // I'm surprised this doesn't seem to exist in jQuery or mw.util.
                        params = {};
-                       hash = hash.replace( '+', '%20' );
+                       hash = hash.replace( /\+/g, '%20' );
                        re = /([^&=#]+)=?([^&#]*)/g;
                        while ( ( m = re.exec( hash ) ) ) {
                                params[ decodeURIComponent( m[ 1 ] ) ] = decodeURIComponent( m[ 2 ] );