Steps to replicate the issue (include links if applicable):
- Create topics with curly brackets (e.g. w:zh:User talk:魔琴/讨论页沙盒/花括号
- Copy the DiscussionTool anchor.
- Construct a Special:GoToComment link with the anchor.
What happens?: It fails complaining about invalid characters inside the special page title. The complain is correct, yet the creation of anchors/fragments with curly brackets breaks the ability to use GoToComment links to refer to comments inside such topics.
What should have happened instead?: GoToComment should either accept the parameter despite having invalid characters, or DiscussionTools should skip invalid title character when creating anchors/fragments.
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia): wmf, zhwiki
Other information (browser name/version, screenshots, etc.):
- This affected Convenient-Discussions's ability to generate GoToComment wikilink syntaxes, as the gadget attempts to feed a GoToComment special page title with curly brackets in it to mw.Title.newFromText, which is designed to reject any titles containing anything outside of wgLegalTitleChars. (CD/src/pageRegistry.js#L55)
- That also shows a lack of null-checking on CD/src/controller.js#L1256, but that's another story.
- I haven't tested whether other non-wgLegalTitleChars characters would cause the same issue, but I guess at least some would. Fixes should look up for wgLegalTitleChars instead of hard-coding curly brackets.
- Note that the browser anchor part works completely fine (i.e. I can navigate with TheTalkPage#c-魔琴-20260518082400-{123}, just not Special:GoToComment/c-魔琴-20260518082400-{123}) , and some might have been using the anchors with curly brackets. It might be a breaking change to remove all illegal title characters from the algorithm for generating anchors/fragments.