Skip to content

StartView: Replace all spaces with _, not just first

Eric Gardner requested to merge T325983 into main

Previously, if the user selected a multi-word title from the autocomplete list like "Phillip K. Dick", they would be taken to a broken ResultsView that corresponded to the invalid URL of "Phillip_K. Dick".

The go() method on the StartView performs some basic title normalization, but the regex which replaced " " with "_" was lacking the /g flag. That flag has been added to ensure that all underscores are now replaced when the selected title is converted into a URL parameter.

In the future, we would ideally rely on the mw-title NPM package to parse titles and namespaces more correctly:

https://www.npmjs.com/package/mediawiki-title

Bug: T325983

Merge request reports