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

Use case-insenstive string comparison for team org ownership #108

Merged
merged 2 commits into from
Feb 12, 2022
Merged

Use case-insenstive string comparison for team org ownership #108

merged 2 commits into from
Feb 12, 2022

Conversation

kyleellman
Copy link
Contributor

If an org name has any capital letters, the normalized team org name will not match the org name.

For instance: an org named Acme with team @Acme/development will end up comparing acme (org) to Acme (v.orgName).

Changes proposed in this pull request:

  • Use case-insensitive string comparison to validate org team ownership.
  • Changed belongs to belong in error message.

Copy link
Owner

@mszostok mszostok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, but it duplicates #78.

But I will merge it soon as you also fixed the misspelling 👍

@@ -180,8 +180,8 @@ func (v *ValidOwner) validateTeam(ctx context.Context, name string) *validateErr
org = strings.TrimPrefix(org, "@")
team := parts[1]

if org != v.orgName {
return newValidateError("Team %q does not belongs to %q organization.", team, v.orgName)
if !strings.EqualFold(org, v.orgName) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's already done in line 176 (name = strings.ToLower(name)) but I need to double-check whether GitHub still does it as someone pointed out that it was changed: #78 (comment)

@mszostok mszostok merged commit 0e709b4 into mszostok:main Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants