Page MenuHomePhabricator

Edge case wikilink parsing bug
Closed, DuplicatePublic

Description

See this transcript which demonstrates the bug:

$  echo '[[Foo|Bar]]]' | php bin/parse.php
<p data-parsoid='{"dsr":[0,16,0,0]}'><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,16,6,2]}'>Bar<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#93;","srcContent":"]","dsr":[9,14,null,null]}'>]</span></a></p>

$  echo '[[Foo|[Bar&#93;]]' | php bin/parse.php
<p data-parsoid='{"dsr":[0,17,0,0]}'>[[Foo|[Bar<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#93;","srcContent":"]","dsr":[10,15,null,null]}'>]</span>]]</p>

This showed up as a broken link on https://dsb.wikipedia.org/wiki/Welar?useparsoid=1 whereas legacy parser doesn't break the link