Allow team names of length 36 to accommodate UUIDs #13097

Closed
opened 2025-11-02 10:30:35 -06:00 by GiteaMirror · 24 comments
Owner

Originally created by @tobiasbp on GitHub (Jun 4, 2024).

Feature Description

When integrating Gitea with other systems, I have the need to create organization teams the correspond to an external resource. As there is no way to tag a team, I would like to name the with a UUID that matches the UUID of my external resource. Users will never see the team names, so there are no UI issues with users wondering about the UUID names for teams.

Currently, the maximum length of a team name is 30 characters. I would like to have that changed to 36, which is the length of a UUID (32 hex characters and 4 hyphens).

I'm happy to make a PR with the change, if someone could point to the current definition in the code. I am unable to find it.

Screenshots

image

Originally created by @tobiasbp on GitHub (Jun 4, 2024). ### Feature Description When integrating _Gitea_ with other systems, I have the need to create organization teams the correspond to an external resource. As there is no way to tag a team, I would like to name the with a _UUID_ that matches the _UUID_ of my external resource. Users will never see the team names, so there are no UI issues with users wondering about the _UUID_ names for teams. Currently, the maximum length of a team name is _30_ characters. I would like to have that changed to _36_, which is the length of a _UUID_ (32 hex characters and 4 hyphens). I'm happy to make a PR with the change, if someone could point to the current definition in the code. I am unable to find it. ### Screenshots ![image](https://github.com/go-gitea/gitea/assets/5671083/805c74e3-98d7-4cd6-80c2-4e3b31ec4950)
GiteaMirror added the type/proposal label 2025-11-02 10:30:35 -06:00
Author
Owner

@KN4CK3R commented on GitHub (Jun 4, 2024):

We could/should increase the length even more.

@KN4CK3R commented on GitHub (Jun 4, 2024): We could/should increase the length even more.
Author
Owner

@silverwind commented on GitHub (Jun 4, 2024):

What is the maximum team length name on GitHub/GitLab?

@silverwind commented on GitHub (Jun 4, 2024): What is the maximum team length name on GitHub/GitLab?
Author
Owner

@KN4CK3R commented on GitHub (Jun 5, 2024):

Looks like they don't have a limit. These are 200 a:
grafik

@KN4CK3R commented on GitHub (Jun 5, 2024): Looks like they don't have a limit. These are 200 a: ![grafik](https://github.com/go-gitea/gitea/assets/1666336/b323d0bd-eb00-498f-81ba-5c09de9df3a5)
Author
Owner

@philippbeckmann commented on GitHub (Jun 5, 2024):

This collection implies the max length on GitHub is 255: https://github.com/dead-claudia/github-limits

@philippbeckmann commented on GitHub (Jun 5, 2024): This collection implies the max length on GitHub is 255: https://github.com/dead-claudia/github-limits
Author
Owner

@delvh commented on GitHub (Jun 5, 2024):

I'm fine with anything below 255, so if there's a PR to change it, I'll approve it.

@delvh commented on GitHub (Jun 5, 2024): I'm fine with anything below 255, so if there's a PR to change it, I'll approve it.
Author
Owner

@silverwind commented on GitHub (Jun 5, 2024):

I'm fine with anything below 255, so if there's a PR to change it, I'll approve it.

you likely meant "at or below" 😛

@silverwind commented on GitHub (Jun 5, 2024): > I'm fine with anything below 255, so if there's a PR to change it, I'll approve it. you likely meant "at or below" 😛
Author
Owner

@tobiasbp commented on GitHub (Jun 6, 2024):

Where in the code should the change be made?

@tobiasbp commented on GitHub (Jun 6, 2024): Where in the code should the change be made?
Author
Owner

@delvh commented on GitHub (Jun 6, 2024):

modules/structs/org_team.go
27:     Name                    string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
43:     Name                    string  `json:"name" binding:"AlphaDashDot;MaxSize(30)"`

I just had a look at the data model (/models/organization/team.go#79), and it looks like that already supports chars up to length 255.
So no need to change anything else

@delvh commented on GitHub (Jun 6, 2024): ```go modules/structs/org_team.go 27: Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"` 43: Name string `json:"name" binding:"AlphaDashDot;MaxSize(30)"` ``` I just had a look at the data model (`/models/organization/team.go#79`), and it looks like that already supports chars up to length 255. So no need to change anything else
Author
Owner

@silverwind commented on GitHub (Jun 6, 2024):

I assume xorm would auto-migrate the column to the new size, right? If yes, then it is just a change in those structs that is ideally accompanied by a small test that creates a team at the new maximum length.

@silverwind commented on GitHub (Jun 6, 2024): I assume xorm would auto-migrate the column to the new size, right? If yes, then it is just a change in those structs that is ideally accompanied by a small test that creates a team at the new maximum length.
Author
Owner

@techknowlogick commented on GitHub (Jun 6, 2024):

@silverwind we require a migration for struct changes that would affect the DB, because even though automigrations will happen, we've run into cases in the past with too large of a version jump in the migration, then some auto-assumed migrations would be skipped (I haven't looked at this specific case though if it'd need the migration/struct change, but from above it seems it is just the validation that needs to be updated).

@techknowlogick commented on GitHub (Jun 6, 2024): @silverwind we require a migration for struct changes that would affect the DB, because even though automigrations will happen, we've run into cases in the past with too large of a version jump in the migration, then some auto-assumed migrations would be skipped (I haven't looked at this specific case though if it'd need the migration/struct change, but from above it seems it is just the validation that needs to be updated).
Author
Owner

@delvh commented on GitHub (Jun 6, 2024):

I assume xorm would auto-migrate the column to the new size, right

As I said, not needed, it's already varchar 255

@delvh commented on GitHub (Jun 6, 2024): > I assume xorm would auto-migrate the column to the new size, right As I said, not needed, it's already `varchar 255`
Author
Owner

@tobiasbp commented on GitHub (Jun 10, 2024):

So, is the only thing needed then to change these values to 255?

modules/structs/org_team.go
27:     Name                    string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
43:     Name                    string  `json:"name" binding:"AlphaDashDot;MaxSize(30)"`
@tobiasbp commented on GitHub (Jun 10, 2024): So, is the only thing needed then to change these values to 255? ```` modules/structs/org_team.go 27: Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"` 43: Name string `json:"name" binding:"AlphaDashDot;MaxSize(30)"` ````
Author
Owner

@techknowlogick commented on GitHub (Jun 10, 2024):

@tobiasbp yes, although I'd suggest making the change locally, compiling, and testing to see if the names can then handle the additional length (in case we are missing another validation area).
I would recommend against bumping the length all the way up to 255 as some filesystems don't like really long paths.

@techknowlogick commented on GitHub (Jun 10, 2024): @tobiasbp yes, although I'd suggest making the change locally, compiling, and testing to see if the names can then handle the additional length (in case we are missing another validation area). I would recommend against bumping the length all the way up to 255 as some filesystems don't like really long paths.
Author
Owner

@delvh commented on GitHub (Jun 10, 2024):

So, let's say 63?

@delvh commented on GitHub (Jun 10, 2024): So, let's say 63?
Author
Owner

@silverwind commented on GitHub (Jun 11, 2024):

@tobiasbp yes, although I'd suggest making the change locally, compiling, and testing to see if the names can then handle the additional length (in case we are missing another validation area). I would recommend against bumping the length all the way up to 255 as some filesystems don't like really long paths.

255 is fine for all common file systems: https://github.com/sindresorhus/valid-filename/blob/main/index.js

@silverwind commented on GitHub (Jun 11, 2024): > @tobiasbp yes, although I'd suggest making the change locally, compiling, and testing to see if the names can then handle the additional length (in case we are missing another validation area). I would recommend against bumping the length all the way up to 255 as some filesystems don't like really long paths. 255 is fine for all common file systems: https://github.com/sindresorhus/valid-filename/blob/main/index.js
Author
Owner

@techknowlogick commented on GitHub (Jun 11, 2024):

@silverwind the folder length is not enough to look at, some FS (in mobile so I can't link) look at the full path as well. I want to say it's exFAT, but it might be another (common one).
I ran into it on my synology, and iirc that's using some btrfs derivative (caveat, I was using an encrypted drive which added additional constraints)

@techknowlogick commented on GitHub (Jun 11, 2024): @silverwind the folder length is not enough to look at, some FS (in mobile so I can't link) look at the full path as well. I want to say it's exFAT, but it might be another (common one). I ran into it on my synology, and iirc that's using some btrfs derivative (caveat, I was using an encrypted drive which added additional constraints)
Author
Owner

@silverwind commented on GitHub (Jun 11, 2024):

@tobiasbp yes, although I'd suggest making the change locally, compiling, and testing to see if the names can then handle the additional length (in case we are missing another validation area). I would recommend against bumping the length all the way up to 255 as some filesystems don't like really long paths.

255 is fine for all common file systems: https://github.com/sindresorhus/valid-filename/blob/main/index.js

Thought Windows does have a restriction called MAX_PATH that limits the full path length to 260 chars. I don't think team names can end up as filenames but for stuff that can (org name, repo name), I think 64 is a good limit.

@silverwind commented on GitHub (Jun 11, 2024): > > @tobiasbp yes, although I'd suggest making the change locally, compiling, and testing to see if the names can then handle the additional length (in case we are missing another validation area). I would recommend against bumping the length all the way up to 255 as some filesystems don't like really long paths. > > 255 is fine for all common file systems: https://github.com/sindresorhus/valid-filename/blob/main/index.js Thought Windows does have a [restriction called MAX_PATH](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) that limits the full path length to 260 chars. I don't think team names can end up as filenames but for stuff that can (org name, repo name), I think 64 is a good limit.
Author
Owner

@tobiasbp commented on GitHub (Jun 13, 2024):

So... What do we want?

  • 👍 63
  • ❤️ 127
  • 🎉 255
@tobiasbp commented on GitHub (Jun 13, 2024): So... What do we want? * 👍 63 * ❤️ 127 * 🎉 255
Author
Owner

@KN4CK3R commented on GitHub (Jun 13, 2024):

Maoam and 255.

@KN4CK3R commented on GitHub (Jun 13, 2024): Maoam and 255.
Author
Owner

@silverwind commented on GitHub (Jun 13, 2024):

255, to match GitHub and because team names will likely never represent in the file system so things like MAX_PATH are not an issue.

@silverwind commented on GitHub (Jun 13, 2024): 255, to match GitHub and because team names will likely never represent in the file system so things like MAX_PATH are not an issue.
Author
Owner

@techknowlogick commented on GitHub (Jun 17, 2024):

Ah, sorry, yes, my bad. I was thinking org name, even though you all have been saying team name this entire time. Please ignore my previous concerns. 255 is definitely a good choice for team name.

@techknowlogick commented on GitHub (Jun 17, 2024): Ah, sorry, yes, my bad. I was thinking org name, even though you all have been saying team name this entire time. Please ignore my previous concerns. 255 is definitely a good choice for team name.
Author
Owner

@silverwind commented on GitHub (Jun 18, 2024):

Repo and org name limitations need to be investigated separately, I posted some regexes in https://github.com/go-gitea/gitea/issues/4150#issuecomment-2142204117, but there is also a length limit.

@silverwind commented on GitHub (Jun 18, 2024): Repo and org name limitations need to be investigated separately, I posted some regexes in https://github.com/go-gitea/gitea/issues/4150#issuecomment-2142204117, but there is also a length limit.
Author
Owner

@tobiasbp commented on GitHub (Jun 18, 2024):

PR to change maximum length of team names to 255 characters: https://github.com/go-gitea/gitea/pull/31410

@tobiasbp commented on GitHub (Jun 18, 2024): PR to change maximum length of team names to 255 characters: https://github.com/go-gitea/gitea/pull/31410
Author
Owner

@techknowlogick commented on GitHub (Jun 19, 2024):

closing due to merged PR

@techknowlogick commented on GitHub (Jun 19, 2024): closing due to merged PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13097