0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-07 01:43:24 +02:00

Add more limitation for forms to create repository

This commit is contained in:
Lunny Xiao 2026-02-18 13:23:22 -08:00
parent 5cd119ba58
commit 829b01312c
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 10 additions and 10 deletions

View File

@ -135,25 +135,25 @@ type CreateRepoOption struct {
// Whether the repository is private
Private bool `json:"private"`
// Label-Set to use
IssueLabels string `json:"issue_labels"`
IssueLabels string `json:"issue_labels" binding:"MaxSize(255)"`
// Whether the repository should be auto-initialized?
AutoInit bool `json:"auto_init"`
// Whether the repository is template
Template bool `json:"template"`
// Gitignores to use
Gitignores string `json:"gitignores"`
Gitignores string `json:"gitignores" binding:"MaxSize(255)"`
// License to use
License string `json:"license" binding:"MaxSize(100)"`
// Readme of the repository to create
Readme string `json:"readme"`
Readme string `json:"readme" binding:"MaxSize(255)"`
// DefaultBranch of the repository (used when initializes and in template)
DefaultBranch string `json:"default_branch" binding:"GitRefName;MaxSize(100)"`
// TrustModel of the repository
// enum: default,collaborator,committer,collaboratorcommitter
TrustModel string `json:"trust_model"`
TrustModel string `json:"trust_model" binding:"In(default,collaborator,committer,collaboratorcommitter)"`
// ObjectFormatName of the underlying git repository
// enum: sha1,sha256
ObjectFormatName string `json:"object_format_name" binding:"MaxSize(6)"`
ObjectFormatName string `json:"object_format_name" binding:"MaxSize(6) In(sha1,sha256)"`
}
// EditRepoOption options when editing a repository's properties

View File

@ -26,10 +26,10 @@ type CreateRepoForm struct {
Description string `binding:"MaxSize(2048)"`
DefaultBranch string `binding:"GitRefName;MaxSize(100)"`
AutoInit bool
Gitignores string
IssueLabels string
Gitignores string `binding:"MaxSize(255)"`
IssueLabels string `binding:"MaxSize(255)"`
License string `binding:"MaxSize(100)"`
Readme string
Readme string `binding:"MaxSize(255)"`
Template bool
RepoTemplate int64
@ -41,8 +41,8 @@ type CreateRepoForm struct {
Labels bool
ProtectedBranch bool
ForkSingleBranch string
ObjectFormatName string
ForkSingleBranch string `binding:"MaxSize(255)"`
ObjectFormatName string `binding:"MaxSize(6) In(sha1,sha256)"`
}
// Validate validates the fields