Page MenuHomePhabricator

Invalid titles cause an TypeError: "mwTitle is null" when looking for a signature in a comment
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. Add a comment with an external link to a wikipage with an illegal character (here it is |): [https://fr.wikipedia.org/wiki/MediaWiki| Test].
  2. Save the comment.
  3. Refresh the page.
  4. Yay the TypeError!

In this case, title = getPageTitleFromUri( "https://fr.wikipedia.org/wiki/MediaWiki|" ) returns MediaWiki| and mwTitle = mw.Title.newFromText( title ) returns null.

The very first check on the title causes the TypeError.

Here an example. Can be reproduced with an external link to any edition (e.g: [https://en.wikipedia.org/wiki/MediaWiki| Test]). I hope it's complete, I just ran into it by coincidence.

Event Timeline

Lofhi updated the task description. (Show Details)
Fralambert rescinded a token.
Fralambert awarded a token.

Change 592727 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] parser: Don't crash on links to invalid titles

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

Change 592727 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] parser: Don't crash on links to invalid titles

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