Skip to content

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

  1. Release N: Add new slug column. Add code that populates slug from name for new records
  2. Release N: Populate slug column, using data from name column with https://docs.gitlab.com/ee/development/database/batched_background_migrations.html.
  3. Release M onwards: Ensure that the slug column has presence validation, and is non-nullable in the database. This includes:
    • Adding presence: true validation to slug
    • Swapping out name in the form with slug
    • Adding a DB migration to set the slug column to be non-nullable
    • Checking all other places where name is used, and replace that with slug instead.
  4. Release M onwards: Now that the name column is no longer used, follow the steps to drop the name column https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#dropping-columns.
  5. Remove the explore_topics_cleaned_path FF, if not already done
Edited by Thong Kuah