r98216 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98215‎ | r98216 | r98217 >
Date:11:24, 27 September 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
WikiLove: Fix bug observed on the cluster where protocol-relative URLs were breaking redirects
Modified paths:
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -689,6 +689,8 @@
690690 targetBaseUrl === currentBaseUrl
691691 // Compatibility with 1.17, 1.18
692692 || mw.config.get( 'wgServer' ) + targetBaseUrl === currentBaseUrl
 693+ // Compatibility with protocol-relative URLs
 694+ || window.location.protocol + mw.config.get( 'wgServer' ) + targetBaseUrl === currentBaseUrl
693695 ) {
694696 window.location.reload();
695697 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r982171.17wmf1: MFT r98216catrope11:25, 27 September 2011
r982181.18wmf1: MFT r98216catrope11:25, 27 September 2011
r98340wikiLove.core: fix breakage on 1.17 wikis with protocol-relative wgServer (bu......krinkle18:14, 28 September 2011

Comments

#Comment by Krinkle (talk | contribs)   18:08, 28 September 2011
 		var targetBaseUrl === currentBaseUrl,
 		currentBaseUrl = window.location.href.split("#")[0];

 		// Compatibility with 1.17, 1.18
 		|| mw.config.get( 'wgServer' ) + targetBaseUrl === currentBaseUrl
+		// Compatibility with protocol-relative URLs
+		|| window.location.protocol + mw.config.get( 'wgServer' ) + targetBaseUrl === currentBaseUrl

Doesn't work as expected under 1.17wmf1 (ie. commons and others)

var targetBaseUrl = mw.util.wikiGetlink(data.redirect.pageName);

this is either /wiki/User:Foo (1.18+) or (http:)//example.org/wiki/User:Foo (1.17), which is why the first fallback prepending wgServer was added in r91853.

now with the variable protocol (relative on wmf-production, non-relative in development and other 'normal' wikis), we need two, not one, extra fallback.

The following is also needed:

// Compatibility with protocol-relative URLs on 1.17
|| window.location.protocol + targetBaseUrl === currentBaseUrl

Status & tagging log