? util.wikiScript() + '?title=' + util.wikiUrlencode( title ) + '&' + query
: util.wikiScript() + '?' + query;
} else {
- url = mw.config.get( 'wgArticlePath' ).replace( '$1', util.wikiUrlencode( title ) );
+ url = mw.config.get( 'wgArticlePath' )
+ .replace( '$1', util.wikiUrlencode( title ).replace( /\$/g, '$$$$' ) );
}
// Append the encoded fragment
} );
} );
- QUnit.test( 'getUrl', 13, function ( assert ) {
+ QUnit.test( 'getUrl', 14, function ( assert ) {
var href;
mw.config.set( {
wgScript: '/w/index.php',
href = mw.util.getUrl( 'Foo:Sandbox? 5+5=10! (test)/sub ' );
assert.equal( href, '/wiki/Foo:Sandbox%3F_5%2B5%3D10!_(test)/sub_', 'complex title' );
+ // T149767
+ href = mw.util.getUrl( 'My$$test$$$$$title' );
+ assert.equal( href, '/wiki/My$$test$$$$$title', 'title with multiple consecutive dollar signs' );
+
href = mw.util.getUrl();
assert.equal( href, '/wiki/Foobar', 'default title' );