Page MenuHomePhabricator

<gallery> handling of link parameter a bit odd
Open, NormalPublic

Description

Gallery handling of link parameter is a bit odd (presumably due to recursiveTagParsing and trimming things before splitting up by '|' instead of after).

Example:

<gallery>
Foo.jpg|link=http://somewhere.com|caption
</gallery>

Expected behaviour: Link to http://somewhere.com
Actual behaviour: Link to http://somewhere.com%2Ccaption

<gallery>
Foo.jpg|link=http://somewhere.com |caption
</gallery>

Expected behaviour: link to http://somewhere.com
Actual behaviour: it treats it as an internal link - http://mywiki.com/w/index.php/http://somewhere.com

I suppose if we changed this we would have to be careful over breaking back-compat(?). In particular the whole recursiveTagParse thing probably means someone is using {{!}} to split up components.

Details

Reference
bz47646

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 1:36 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz47646.
bzimport added a subscriber: Unknown Object (MLST).
Bawolff created this task.Apr 25 2013, 2:49 PM

I'm going to add to this bug other oddities with the link= parameter in galleries (I'm not sure if it should be split, but seemed related):

  • Internal links with an anchor: The anchor is stripped from the link:

    File:Foo.jpg|link=Article#Anchor Is rendered with a link to Article

Test case: https://www.mediawiki.org/w/index.php?oldid=849650

Bumping importance & priority to normal, since for issues in comment 1 there are no workarounds (workaround for comment 0 is to leave the link= parameter at the end). Maybe it would make sense to split it, but I'm not sure if it's something specific to galleries or more general as Bawolff suggests

Qgil added a comment.Feb 21 2014, 8:07 PM

Also, it would make sense to expect that "link=" removes the link from the image just as it does in regular image links. However, the link persists.

I can file a separate bug about this, if that helps.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 14 2015, 11:12 PM
MGChecker updated the task description. (Show Details)Aug 14 2017, 1:46 PM