Page MenuHomePhabricator

Links to the foreign repository pictures use local wiki and not foreign repo file namespace
Closed, ResolvedPublic

Description

[ Bug symptoms ]

As highlighted on https://www.mediawiki.org/wiki/Talk:Multimedia/About_Media_Viewer#On_Wikipedia.2C_links_don.27t_go_to_Commons, the link to the file on Commons contained twice the file namespace.

For example, [[File:Quux.jpg]] linked to http://commons.wikimedia.org/wiki/File:File:Quux.jpg

This has been fixed, writing once the namespace. So for en. File:File: became File: and all is fine.

But in other MediaWiki languages, the link were:
http://commons.wikimedia.org/wiki/File:Fichier:Quux.jpg

And is now:
http://commons.wikimedia.org/wiki/Fichier:Quux.jpg

But it should be:
http://commons.wikimedia.org/wiki/File:Quux.jpg

Thank you to Okki for reporting this.

[ Bug analysis ]

In ext.multimediaViewer.lightboxinterface.js, LIP.setFilePageLink:

For Commons as foreign repo, linkpath = repoInfo.server + repoInfo.articlepath
repoInfo.articlepath is /wiki/$1, $1 being substituted by fileTitle.getPrefixedText().

Instead, $1 should be replaced by repofileNameSpace + ":" + fileTitle.getMain().

Where repofileNameSpace is the file namespace on the foreign repo.


Version: unspecified
Severity: major

Details

Reference
bz59863

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:32 AM
bzimport set Reference to bz59863.
bzimport added a subscriber: Unknown Object (MLST).

Oh. Hm.

There's not currently any way to get the name of the file namespace on the foreign host.

So...

I guess we can write this support into core, but it will take a while to review and push out.

Yay, core bugs!

Oh, wait. We don't need to make this complicated, because we have the descriptionurl element of the API response. That seems way easier.

I'll mark this easy - take the big complicated link construction code, delete most of it, and use innerInfo.descriptionurl instead.

Thanks, Dereckson!

This has been fixed by change Ife8293c86683ea914b1a5a60000584b501d92e55.

This change introduced another bug, bug 60099.