[FEAT] Trim spaces from repository name

- This uses the `TrimSpace` preprocessing of the binding library to
remove any accidental spaces from the input.
- Integration test added.
- Resolves #4309
This commit is contained in:
Gusted 2024-11-05 22:05:35 +01:00
parent 310376525b
commit 4952747699
No known key found for this signature in database
GPG key ID: FD821B732837125F
2 changed files with 19 additions and 1 deletions

View file

@ -27,7 +27,7 @@ import (
// CreateRepoForm form for creating repository
type CreateRepoForm struct {
UID int64 `binding:"Required"`
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)" preprocess:"TrimSpace"`
Private bool
Description string `binding:"MaxSize(2048)"`
DefaultBranch string `binding:"GitRefName;MaxSize(100)"`