Page MenuHomePhabricator

CodeMirror links to the wrong page when $wgTemplateStylesDefaultNamespace is not set to the Template namespace
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

  • Install TemplateStyles and CodeMirror
  • Set $wgTemplateStylesDefaultNamespace = 8;
  • Create a template style in the MediaWiki namespace, e.g. MediaWiki:Test.css
  • Change its content model to Sanitized CSS
  • Use <templatestyles src="Test.css" /> and make sure it loads correctly
  • Use Ctrl+click on the src attribute value in CodeMirror

What happens?: Nonexistent page Template:Test.css opens.

What should have happened instead?: The correct page, MediaWiki:Test.css, should have opened.

Software version: MediaWiki 1.45.3 (d2cfa30). TemplateStyles 1.0 (e898cce)

Other information: This happens because this line assumes the namespace is 10, even though it's configurable. The fix would probably involve injecting $wgTemplateStylesDefaultNamespace as a JS config var.

Event Timeline

Change #1276831 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] DataScript: $wgTemplateStylesDefaultNamespace

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

Bhsd changed the task status from Open to In Progress.Apr 24 2026, 12:50 AM
Bhsd claimed this task.
Bhsd moved this task from Backlog to Bugs on the MediaWiki-extensions-CodeMirror board.

Change #1276831 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] DataScript: $wgTemplateStylesDefaultNamespace

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

Bhsd moved this task from Bugs to Done on the MediaWiki-extensions-CodeMirror board.