Page MenuHomePhabricator

Wikilink to special page with urlencoded newline shown as redlink
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):
When a wikilink to a special page like Special:PermaLink contains an anchor with urlencoded newline %0A, the link is shown as red link, because the title parser detects this as a page in the main namespace

  • Preview the wikitext:
* [[Special:PermaLink/123#An%0Achor]]
* [[Special:PermaLink/123]]
  • The first link is red (not expected), the second blue (expected)

What happens?:
Parsing the example with api: https://www.mediawiki.org/w/api.php?action=parse&prop=links|text&text=[[Special:PermaLink/123%23An%250Achor]][[Special:PermaLink/123]]&title=MyPage

This api call shows that the link to Special:PermaLink is reported as ns:0.
Also this link is tracked in the pagelinks table with namespace 0 and shown as invalid in namespaceDupes.php (T294495)

What should have happened instead?:
The link should be handled as special page link.

Namespace splitting in the TitleParser (MediaWikiTitleCodec is the implementation) is done via regex, but the dot there is not matching newlines, so the regex does not match anything and the title parser handles the page as main namespace.

Software version (skip for WMF-hosted wikis like Wikipedia): master