Page MenuHomePhabricator

Gallery styles missing on local file description pages
Open, Needs TriagePublic

Description

The style for <gallery> is not anymore loaded when in File namespace the page is transcluded from a file repo like Wikimedia Commons.

Compare

https://de.wikipedia.org/wiki/Datei:Coax_to_10BaseT_Converter_-_Milan_Model_MIL_120A-2695.jpg

with

https://commons.wikimedia.org/wiki/File:Coax_to_10BaseT_Converter_-_Milan_Model_MIL_120A-2695.jpg

Probably a regression from Ib1aef04dc4fece78e6615386ecaef6a9f368f49e (Only load gallery styling rules when galleries are on the page)

Event Timeline

Raymond raised the priority of this task from to Needs Triage.
Raymond updated the task description. (Show Details)
Raymond subscribed.

... which was merged in August, how come this bug was not noticed?

rMW7c702db019f363237aa893c13f333acc71ab1eaf, actually, which is a follow-up to that one (and only a month old).

So… do foreign repositories still use index.php?action=raw, rather than api.php?action=parse? If so, this is not going to work, and it has never worked with other features that require custom styles (like <syntaxhighlight> or Babel extension boxes). It just so happens that most of those cases were in extensions and not in core so far.

(They still do, the code is in FileRepo::getDescriptionRenderUrl and File::getDescriptionText. It essentially loads and embeds https://commons.wikimedia.org/w/index.php?title=File:Coax_to_10BaseT_Converter_-_Milan_Model_MIL_120A-2695.jpg&action=render, which – as you can see – has no styles associated.)

We probably want to migrate it to using API's action=parse like GlobalUserPage is doing, but that'll cause issues due to T42128.

Also also, we should be careful about loading modules based on a foreign parser. It may sort-of work for more stable modules from MediaWiki core and extensions, but I'm not sure it's the right approach to load local modules by the same name.

They will be different versions within Wikimedia (unless the client wiki and Commons are in the same group). And for third parties there can be much wider discrepancies. Unless we consider these "low-priority enhancements", that means we need to keep them in mentioned in the parser to third-parties until the oldest supported version supports the new module name, for example.

Also also, we should be careful about loading modules based on a foreign parser.

Should the modules get also loaded from the foreign wiki?

matmarex edited subscribers, added: Jdlrobson; removed: Konfused-Kitten.
Krinkle renamed this task from [Regression] gallery style not loaded when page is transcluded from forein file repo to Gallery styles missing on local file description pages.Jul 11 2016, 10:20 PM
dr0ptp4kt added subscribers: dpatrick, dr0ptp4kt.

@dpatrick bringing to your attention in case this is something your team might want to weigh in on.

Decouple from seemingly unrelated parent task. Not sure what I was thinking in 2016. This seems pretty straight-forward. The styles are queued by the Parser, available in the modules/moduleStyles array, and already exposed by API action=parse. It just needs to be queued when displaying the local file page as well. Basically the same as we do already for GlobalUserPage.

This bug has BLP implications when there are captions identifying living people. Without gallery styles it looks like captions belong to the following image. Compare for example commons and enwiki. The latter looks like we claim Ariela Lowenstein is a bald man because the caption is far closer to that image.