Do not allow special characters in new project names

What does this MR do and why?

Fixes #349047 (closed)

See Special characters in project path causes Conta... (#27483).

Add a new validation that checks whether the project path conforms to [a-z0-9]+([._-][a-z0-9]+)*(/[a-z0-9]+([._-][a-z0-9]+)*)*. This restricts special characters at the start or the end of the project path and also restricts consecutive special characters in the project path. The regex used in this MR has been simplified as the project path cannot contain the forward-slash / character.

The validation only runs when the project path is updated or added. It will not run when any other project fields are updated or the project is read or deleted.

Note: This new validation is behind a feature flag.

Screenshots or screen recordings


How to set up and validate locally

  1. Enable the feature flag
  2. Menu -> Projects -> Create new project
  3. Create a new project with the Project slug having _, -, or . at the start or end (or containing 2 or more consecutive such characters in between).
  4. Validation error is thrown.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Abdul Wadood