Page MenuHomePhabricator

Don't use protocol relative links to Commons in MultimediaViewer
Open, Needs TriagePublic

Description

On some occasions, MMV still suggests protocol relative rules to Commons. E.g.

  1. Go to https://en.wikipedia.org/wiki/Wikipedia#/media/File:History_Comparison_Example_(Vector).png
  2. Click the download icon.
  3. Click "You need to attribute the author"
  4. Click "HTML"
  5. Copy the code.

You get: By Cody Brittain (<a href="//commons.wikimedia.org/wiki/User:Cbrittain10" title="User:Cbrittain10">Cbrittain10</a>) - Wikipedia, <a href="https://creativecommons.org/licenses/by-sa/3.0" title="Creative Commons Attribution-Share Alike 3.0">CC BY-SA 3.0</a>, <a href="https://commons.wikimedia.org/w/index.php?curid=31349187">Link</a>

If you use this code somewhere with https, the protocol relative URL is equivalent to https://commons.wikimedia.org/wiki/User:Cbrittain10, if you use it with http, you'll just get redirected to the same URL.

So the protocol relative URLs no longer make sense and should be replaced with explicit https.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

The links come from File::getDescriptionText() which just fetches https://commons.wikimedia.org/wiki/File:History_Comparison_Example_(Vector).png?action=render. So this has something to with internal link parsing (and specifically this horrible thing).

So, the root cause here is that $wgServer on Commons is set to "//commons.wikimedia.org" while arguably it should be "https://commons.wikimedia.org".

Or possibly that code should be using $wgCanonicalServer…?

Yeah; that's T118413: Wikimedia wikis should use https:// in $wgServer.

IMO using $wgServer is correct; when the server does support both protocols, you want the URLs in the description (and rendered pages in general) to be relative.

matmarex renamed this task from Don't use protocol relative links to Commons to Don't use protocol relative links to Commons in MultimediaViewer.Oct 17 2017, 9:43 PM
matmarex edited projects, added WMF-General-or-Unknown; removed CommonsMetadata.