Page MenuHomePhabricator

"link=" parameter in [[File:]] cannot link to Media pseudo-namespace
Open, MediumPublic

Description

On production wikis ...

[[File:Loudspeaker.svg|11px|link=Media:En-us-Cyprus.ogg]]

... should link to https://upload.wikimedia.org/wikipedia/commons/f/f0/En-us-Cyprus.ogg, just like [[Media:En-us-Cyprus.ogg]] does, but instead it links to https://en.wikipedia.org/wiki/Media:En-us-Cyprus.ogg, which is wrong.

This bug exists in both the Parser and Parsoid output.

Details

Reference
bz16409

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:25 PM
bzimport set Reference to bz16409.
bzimport added a subscriber: Unknown Object (MLST).

herd wrote:

You should be able to use Special:Filepath/{{{1}}} although this is an imperfect solution.

Also possibly related is bug 16162

capmo700 wrote:

Currently (MW 1.19) the "link=Media:Something.ogg" syntax is accepted but takes us to the file description page instead of actually opening the media file as would be expected:

[[File:Something.ogg]] -> opens the file description page
[[File:Image.gif|link=File:Something.ogg]] -> opens the file description page

[[Media:Something.ogg]] -> links to media file
[[File:Image.gif|link=Media:Something.ogg]] -> opens the file description page (should link to media file!)

hmmm, that's kind of odd. NS_MEDIA is special cased in Parser::replaceInternalLinks2 instead of having Title::getLocalUrl output the file's url directly...

kaldari raised the priority of this task from Low to Needs Triage.Oct 27 2020, 11:38 AM
kaldari added a project: Parsoid-Rendering.
kaldari edited projects, added Parsoid; removed Parsoid-Rendering.
kaldari renamed this task from New "link=" parameter in [[Image: - cannot link to Media: to "link=" parameter in [[File:]] cannot link to Media psuedo-namespace.Oct 27 2020, 11:47 AM
kaldari updated the task description. (Show Details)
kaldari removed a subscriber: wikibugs-l-list.
kaldari renamed this task from "link=" parameter in [[File:]] cannot link to Media psuedo-namespace to "link=" parameter in [[File:]] cannot link to Media pseudo-namespace.Oct 27 2020, 11:49 AM

@ssastry - Recently I discovered that the reason that pronunciation links on Wikipedia are backwards (the speaker icon links to the file page, while the text links to the actual audio) is because of this 12 year old parser bug. It looks like the bug got integrated into Parsoid as well in order to match the Parser output. The purpose of the Media pseudo-namespace is to easily allow linking to files directly, but for some reason this was never implemented correctly for the link parameter in File links. @Bawolff came tantalizingly close to fixing this seven years ago, but sadly it was never followed up on. Just wanted to bring it to your attention so it could finally be properly triaged.

ssastry triaged this task as Medium priority.Oct 27 2020, 3:57 PM
ssastry moved this task from Needs Triage to Bugs & Crashers on the Parsoid board.