Page MenuHomePhabricator

File and global user pages should not be redirected
Open, NormalPublic

Description

After talking about T148118 with @Tgr I brought up that RESTBase redirects pages that are actually stored in the Commons project.
This can lead to I18n issues. Example:
https://de.wikipedia.org/api/rest_v1/page/mobile-sections/Datei%3APrussian_standard.jpg (German) redirects to https://commons.wikimedia.org/wiki/File:Prussian_standard.jpg (English).
On the desktop web site the page https://de.wikipedia.org/wiki/Datei:Prussian_standard.jpg shows the text in German, though.

The same seems to happen for Parsoid: https://de.wikipedia.org/api/rest_v1/page/html/File%3APrussian_standard.jpg redirects to https://commons.wikimedia.org/api/rest_v1/page/html/File%3APrussian_standard.jpg, resulting in English text.

I think we should stop redirecting for File pages, and potentially for global user pages, too.

Here's some extra info from my IRC chat with @Tgr in #wikimedia-reading on Dec. 20, 2016:

  • IIRC this is handled by ForeignDBFile::getDescription() and that will just make a HTTP request to <commons description page>?action=render&uselang=<local wiki content language> and show that on the top of the editable part of the file page
  • theoretically, you can have both local and remote file page for an image, and the contents of both will be displayed
  • commons uses section titles like == {{intl:licensing}} == so that they can be shown in the right language when transcluded and the templates use various horrible hacks to change their text depending on what language you view them in. https://commons.wikimedia.org/wiki/Commons:Localization#Content_internationalization_methods has the gory details
  • Are there any similar cases?

<tgr> global user pages. If you are asking about including content from a remote wiki, those are the only two cases I can think of

Event Timeline

bearND created this task.Dec 20 2016, 10:15 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 20 2016, 10:15 PM
Pchelolo edited projects, added Services (next); removed Services.Jan 6 2017, 6:16 PM
Pchelolo added subscribers: ssastry, Pchelolo.

This feature was requested a while ago by the apps team, because file pages were not displayed in the app for files that exist on commons, not on the wiki. The feature works as follows:

  1. Try to load get file page on-wiki
  2. If 404 - try redirecting to commons
  3. If 404 and it is already commons - throw 404.

The problem is that pages for files on commons do not really exist on-wiki, so Parsoid can't render it (example), also ChangeProp only gets notified for commons domain, but not for all the rest of the domains which the file is accessible through.

There're two approaches to fixing this I can think of:

  1. Support rendering special-case file pages in Parsoid, stop redirecting, make a rule in ChangeProp that would rerender all domains for commons file change. The obvious downside of this approach is significantly higher load on Parsoid and Mobile-Content-Service for commons file uploads.
  2. After adding support for language variants ( T122942 ) redirect to a specific variant of the page on commons. For this to work we can't use Accept headers for language variant specification, only some uri parameter, because obviously we can't specify which accept header to use after following the redirect and accept headers were the most likely way of representing language variants in the api.

@ssastry What would it take to support rendering file pages in Parsoid ?

Tgr added a subscriber: Legoktm.Jan 6 2017, 11:12 PM

Not sure if global user pages present the same problem (that they are parsed in different languages for different wikis). @Legoktm would surely know.

Yes, GlobalUserPages pass the same &uselang= parameter.

Arlolra triaged this task as Normal priority.Jul 19 2017, 9:01 PM

Change 392078 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[marvin@master] Update: show image on image File pages

https://gerrit.wikimedia.org/r/392078

Change 392078 merged by jenkins-bot:
[marvin@master] Update: show image on image File pages

https://gerrit.wikimedia.org/r/392078