Only allow URL safe characters (ASCII) for topic_explore_projects_path
Previous discussion in !122970 (comment 1422903154)
The topic_explore_projects_path_path(topic_name: )
accepts too much. We should restrict character set for Topic#name
. Note we already have Topic#title
for user facing string
To also solve for #479264 for unicode users, rather than a blanket "invalid characters" message we should separately identify that unicode characters are not possible and must be replaced by ASCII characters. Solved in !168899 (merged).
Implementation Guide
-
Release N: Add new slug
column. Add code that populatesslug
fromname
for new records -
Release N: Populate slug
column, using data fromname
column with https://docs.gitlab.com/ee/development/database/batched_background_migrations.html. -
Release M onwards: Ensure that the slug
column has presence validation, and is non-nullable in the database. This includes:- Adding
presence: true
validation toslug
- Swapping out
name
in the form withslug
- Adding a DB migration to set the
slug
column to be non-nullable - Checking all other places where
name
is used, and replace that withslug
instead.
- Adding
-
Release M onwards: Now that the name
column is no longer used, follow the steps to drop thename
column https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#dropping-columns
Edited by Alex Pooley