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.