Page MenuHomePhabricator

Incorrect href for subpage links in non-subpage-enabled namespaces in Parsoid HTML
Open, MediumPublic

Description

In the main namespace (if subpages are disabled there, which is the default), the wikitext [[/foo]] produces a link with href .//foo, which matches the behavior of the PHP parser more or less (although it should probably be ./%23foo instead).

However, in non-main namespaces where subpages are disabled, the PHP parser and Parsoid don't match. For example, in the MediaWiki namespace on enwiki(*), parsing [[/foo]] results in href="/w/index.php?title=/bar&action=edit&redlink=1" in the PHP parser, but href="./MediaWiki:/foo/ in Parsoid. Similarly, in the Topic namespace on cawiki, Parsoid produces href="./Tema:/foo".

(*) Subpages are enabled in the MW namespace in the default config, but enwiki's config overrides this and disables them. Many other WMF wikis also disable subpages in the MW namespace.

$ echo '[[/subpage]]' | ./bin/parse.js --body_only --pageName=Foo --loadWMF --prefix=enwiki
<p data-parsoid='{"dsr":[0,12,0,0]}'><a rel="mw:WikiLink" href=".//subpage" title="/subpage" data-parsoid='{"stx":"simple","a":{"href":".//subpage"},"sa":{"href":"/subpage"},"dsr":[0,12,2,2]}'>/subpage</a></p>

$ echo '[[/subpage]]' | ./bin/parse.js --body_only --pageName=MediaWiki:Foo --loadWMF --prefix=enwiki
<p data-parsoid='{"dsr":[0,12,0,0]}'><a rel="mw:WikiLink" href="./MediaWiki:/subpage" title="MediaWiki:/subpage" data-parsoid='{"stx":"simple","a":{"href":"./MediaWiki:/subpage"},"sa":{"href":"/subpage"},"dsr":[0,12,2,2]}'>/subpage</a></p>

$ echo '[[/subpage]]' | ./bin/parse.js --body_only --pageName=Topic:Foo --loadWMF --prefix=cawiki
<p data-parsoid='{"dsr":[0,12,0,0]}'><a rel="mw:WikiLink" href="./Tema:/subpage" title="Tema:/subpage" data-parsoid='{"stx":"simple","a":{"href":"./Tema:/subpage"},"sa":{"href":"/subpage"},"dsr":[0,12,2,2]}'>/subpage</a></p>

Event Timeline

LGoto triaged this task as Medium priority.May 1 2020, 4:09 PM
LGoto moved this task from Backlog to Bugs & Crashers on the Parsoid board.

Change #1305869 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/services/parsoid@master] Handle colon prefixed links in NSs that allow subpages

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

Change #1305869 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Handle slash prefixed links in NSs that allow subpages

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

Change #1310144 had a related patch set uploaded (by OSleger; author: OSleger):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a15

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

Change #1310144 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a15

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

Change #1312554 had a related patch set uploaded (by Arlolra; author: OSleger):

[mediawiki/vendor@wmf/1.47.0-wmf.11] Bump wikimedia/parsoid to 0.24.0-a15

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

Change #1312554 merged by jenkins-bot:

[mediawiki/vendor@wmf/1.47.0-wmf.11] Bump wikimedia/parsoid to 0.24.0-a15

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

Mentioned in SAL (#wikimedia-operations) [2026-07-20T20:17:16Z] <arlolra@deploy2003> Started scap sync-world: Backport for [[gerrit:1312547|Enable PRV on enwiki talk namespace, template namespace]], [[gerrit:1312554|Bump wikimedia/parsoid to 0.24.0-a15 (T221028 T226289 T353697 T430854 T431771)]], [[gerrit:1312556|Bump wikimedia/parsoid to 0.24.0-a15 (T431771)]]

Mentioned in SAL (#wikimedia-operations) [2026-07-20T20:20:59Z] <arlolra@deploy2003> arlolra, cscott: Backport for [[gerrit:1312547|Enable PRV on enwiki talk namespace, template namespace]], [[gerrit:1312554|Bump wikimedia/parsoid to 0.24.0-a15 (T221028 T226289 T353697 T430854 T431771)]], [[gerrit:1312556|Bump wikimedia/parsoid to 0.24.0-a15 (T431771)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-07-20T20:32:24Z] <arlolra@deploy2003> Finished scap sync-world: Backport for [[gerrit:1312547|Enable PRV on enwiki talk namespace, template namespace]], [[gerrit:1312554|Bump wikimedia/parsoid to 0.24.0-a15 (T221028 T226289 T353697 T430854 T431771)]], [[gerrit:1312556|Bump wikimedia/parsoid to 0.24.0-a15 (T431771)]] (duration: 15m 07s)