Page MenuHomePhabricator

Handle interwiki links in media `link=` params
Open, MediumPublic

Description

In https://gerrit.wikimedia.org/r/#/c/396067/ @cscott exposed this,

$ echo "[[File:Foobar.jpg|alt=galleryalt|link=meatball:Link]]" | node bin/parse --normalize
<p><figure-inline><a href="Meatball:Link"><img alt="galleryalt" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" data-file-width="240" data-file-height="28" data-file-type="bitmap"  height="28" width="240"/></a></figure-inline></p>

In handleInfo, the o.hasLink case (https://github.com/wikimedia/parsoid/blob/master/lib/wt2html/tt/LinkHandler.js#L1432-L1459) probably needs a call to getWikiLinkTargetInfo instead of just the makeTitleFromText

Event Timeline

Arlolra triaged this task as Medium priority.Dec 12 2017, 2:32 AM
ssastry lowered the priority of this task from Medium to Low.Feb 28 2020, 5:14 PM
ssastry moved this task from Link syntax (links & media) to Bugs & Crashers on the Parsoid board.

T18409 is another case that would benefit from a call to getWikiLinkTargetInfo

Change #1095481 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/services/parsoid@master] WIP: Fix media with `link=` pointing to an interwiki link

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

2026 version of this bug does this at https://ru.wikipedia.org/wiki/Макмиллан,_Дональд

<a href="//ru.wikipedia.org/wiki/en:Peary_Polar_Expedition_Medal" title="en:Peary Polar Expedition Medal"><img resource="//ru.wikipedia.org/wiki/Файл:Perry_Polar_Expedition_Medal_ribbon.png" src="//upload.wikimedia.org/wikipedia/commons/thumb/9/91/Perry_Polar_Expedition_Medal_ribbon.png/60px-Perry_Polar_Expedition_Medal_ribbon.png" decoding="async" data-file-width="212" data-file-height="60" data-file-type="bitmap" height="17" width="60" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/9/91/Perry_Polar_Expedition_Medal_ribbon.png/120px-Perry_Polar_Expedition_Medal_ribbon.png 2x" class="mw-file-element"></a>

The link is not to a wrong place but because it’s not resolved properly, you see a failed Page Previews popup.