Validation error message incorrect when creating subgroup beginning with dot or underscore

Summary

When attempting to create a subgroup where the URL slug begins _ you get an error message that doesn't explain what is wrong

Steps to reproduce

  1. Go to a group in gitlab.com where you have access to create a subgroup
  2. Click "New subgroup"
  3. In the "Subgroup name" field, type _foo
  4. Check that "Subgroup slug" is also automatically populated with _foo
  5. Click "Create subgroup"

Example Project

N/A, doesn't relate to a project

What is the current bug behavior?

You will get an error:

The form contains the following error: Group URL can only include non-accented letters, digits, '_', '-' and '.'. It must not start with '-', end in '.', '.git', or '.atom'.

But _foo does actually meet the requirements described in this error message - it does contain only non-accented letters, digits, _, - and ., it does not start with - or end in ., .git or .atom

The same is true of .foo - it meets the requirements described in the error message but cannot be created.

What is the expected correct behavior?

The error message should correctly describe the restrictions, as listed in https://docs.gitlab.com/ee/user/reserved_names.html#limitations-on-usernames-project-and-group-names - in particular it should include the 3 requirements below which it doesn't at present:

Usernames, project or group slugs:

  • Must start with a letter (a-zA-Z) or digit (0-9).
  • Must not contain consecutive special characters.
  • Cannot start or end with a special character.

Relevant logs and/or screenshots

image

Output of checks

N/A

Results of GitLab environment info

N/A - using gitlab.com

Results of GitLab application Check

N/A - using gitlab.com

Possible fixes

N/A

Edited by 🤖 GitLab Bot 🤖