diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 8146166465..25918ce0d4 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -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 diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 956329f480..bfd7eb96b5 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -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