(bug 31499) articlePathRegex (detection of external links within the same wiki) broken when wgServer is protocol-relative

This commit is contained in:
Roan Kattouw 2011-10-25 14:30:33 +00:00
parent 11aabbd4a9
commit 280ae464a4
Notes: Roan Kattouw 2011-10-25 14:30:33 +00:00

View file

@ -502,9 +502,11 @@ getDefaultConfig: function () {
}
},
open: function() {
// Obtain the server name without the protocol. wgServer may be protocol-relative
var serverName = mw.config.get( 'wgServer' ).replace( /^(https?:)?\/\//, '' );
// Cache the articlepath regex
$(this).data( 'articlePathRegex', new RegExp(
'^' + $.escapeRE( mw.config.get( 'wgServer' ) + mw.config.get( 'wgArticlePath' ) )
'^https?://' + $.escapeRE( serverName + mw.config.get( 'wgArticlePath' ) )
.replace( /\\\$1/g, '(.*)' ) + '$'
) );
// Pre-fill the text fields based on the current selection