Categories of a page showing broken hyperlinks in edit mode in VisualEditor
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • notice that the Category name displays something like "Index.php?title=Category:TestCategory2" in red.
  • save the page, the Category will turn back normal

What should have happened instead?:
the categories should not display a broken URL.

Software version (skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.39.1
PHP 7.4.33 (cgi-fcgi)
MySQL 5.7.41
ICU 69.1
Lua 5.1.5

Other information (browser name/version, screenshots, etc.):
Wiki was just upgraded from 1.35.0 to 1.39.1.
Also attached a screenshot for the issue.

Editing_TestPage_-_测试.png (886×2 px, 112 KB)

Event Timeline

Does this also happen when using safemode? See https://www.mediawiki.org/wiki/Help:Locating_broken_scripts

On a side note: Your MediaWiki:Common.js has broken code (maybe only when logged out, impossible to test as there is no way to register): Uncaught TypeError: vimBackButton is null.

Does this also happen when using safemode? See https://www.mediawiki.org/wiki/Help:Locating_broken_scripts

On a side note: Your MediaWiki:Common.js has broken code (maybe only when logged out, impossible to test as there is no way to register): Uncaught TypeError: vimBackButton is null.

Sorry for that! I just created a test user, please try using username: testuser, password: Password23.
Tried safemode and still having same issue.
By the way I just removed the old code in MediaWiki:Common.js.

There are unfortunately some known issues with VisualEditor on wikis that are not using short URLs (e.g. /index.php?title=TestPage, rather than /wiki/TestPage like on Wikipedia).

If you're able to set up short URLs, then that should avoid this problem: https://www.mediawiki.org/wiki/Manual:Short_URL

Otherwise you might have to live with it for now.

There are unfortunately some known issues with VisualEditor on wikis that are not using short URLs (e.g. /index.php?title=TestPage, rather than /wiki/TestPage like on Wikipedia).

If you're able to set up short URLs, then that should avoid this problem: https://www.mediawiki.org/wiki/Manual:Short_URL

Otherwise you might have to live with it for now.

Thank you, let me try Short_URL.

So this is the second ticket opened for the same issue (I opened the other one T265144). As mentioned in the other ticket, this was working fine before. So what if it not possible to switch our site to short URLs? As far as you remark ("you might haver to live with it for now"), how long do you think the "for now" will be :-)

I don't know. I don't think this is a priority for the team, so it may be never :(

By the way, short URLs of the form https://en.wikipedia.org/w/index.php/Foobar are enabled by default in MediaWiki these days, and may already work on your wiki. If you haven't looked into it in a while, try viewing a page with a URL like that (path to index.php, a slash, and then page title). If it works, you can set $wgUsePathInfo = true to make MediaWiki use this as the canonical URL.

@matmarex If I provide a fix, what is the chance of it being included in the code base?

I'd be happy to accept it as long as it works. The approach you shared in T265144#6532671 seems too simple to work. Make sure to test your solution with special characters in page titles like &, ? and %, and to test it with different values for $wgScript and other related config settings. Make sure that it works when viewing existing links, adding new ones, or saving changes to a link. Sorry I'm being a bit vague, but it would be some work to even figure out all the cases that need to be tested :)