Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username regex blocking Code Owners from showing #558

Closed
darylgraham opened this issue Sep 4, 2024 · 2 comments · Fixed by #597
Closed

Username regex blocking Code Owners from showing #558

darylgraham opened this issue Sep 4, 2024 · 2 comments · Fixed by #597
Labels

Comments

@darylgraham
Copy link
Contributor

The Code Owners section of the People card does not show, and the console shows the following error:

failed to load codeowners Error: @graham.daryl is not a valid owner name in rule * @user.name

The regex used to validate usernames here does not appear to allow periods in the username: https://github.com/immobiliare/backstage-plugin-gitlab/blob/main/packages/gitlab/src/components/utils.tsx#L116

The Gitlab documentation says they are an allowed character: https://docs.gitlab.com/ee/user/profile/

Going by the naming rules (which also say usernames cannot start with _-.), maybe the first capture group should look something like this?

- (^@[a-zA-Z0-9_\-/]*$)
+ (^@[a-zA-Z0-9][a-zA-Z0-9_\-/\.]*$)
@antoniomuso
Copy link
Contributor

Hi @darylgraham, Thank you for the issue. You are right!
We can simplify all the regex in something like:

^@[a-zA-Z0-9][a-zA-Z0-9_\-\.]*([a-zA-Z0-9_\-]|[a-zA-Z0-9_])$

following the official regex: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/path_regex.rb#L137

Copy link

github-actions bot commented Oct 5, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants