From 711e0c5ba4944574544b8d1cedac7ab6aa0dc655 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Fri, 9 Sep 2022 08:38:54 +0200 Subject: [PATCH 1/2] Limit length of repo description and repo url input fields --- templates/repo/settings/options.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index a9ceebd446094..f23bb597894ae 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -42,11 +42,11 @@ {{end}}
- +
- +
From 910d8964c5146a85b3f5e61b630e33c2e641347e Mon Sep 17 00:00:00 2001 From: JakobDev Date: Fri, 16 Sep 2022 08:13:40 +0200 Subject: [PATCH 2/2] Make limits higher --- modules/structs/repo.go | 10 +++++----- services/forms/repo_form.go | 8 ++++---- templates/repo/settings/options.tmpl | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 6a5736898d139..d3833105d7269 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -111,7 +111,7 @@ type CreateRepoOption struct { // unique: true Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"` // Description of the repository to create - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` // Whether the repository is private Private bool `json:"private"` // Label-Set to use @@ -140,9 +140,9 @@ type EditRepoOption struct { // unique: true Name *string `json:"name,omitempty" binding:"OmitEmpty;AlphaDashDot;MaxSize(100);"` // a short description of the repository. - Description *string `json:"description,omitempty" binding:"MaxSize(255)"` + Description *string `json:"description,omitempty" binding:"MaxSize(2048)"` // a URL with more information about the repository. - Website *string `json:"website,omitempty" binding:"MaxSize(255)"` + Website *string `json:"website,omitempty" binding:"MaxSize(1024)"` // either `true` to make the repository private or `false` to make it public. // Note: you will get a 422 error if the organization restricts changing repository visibility to organization // owners and a non-owner tries to change the value of private. @@ -208,7 +208,7 @@ type GenerateRepoOption struct { // Default branch of the new repository DefaultBranch string `json:"default_branch"` // Description of the repository to create - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` // Whether the repository is private Private bool `json:"private"` // include git content of default branch in template repo @@ -316,7 +316,7 @@ type MigrateRepoOptions struct { LFS bool `json:"lfs"` LFSEndpoint string `json:"lfs_endpoint"` Private bool `json:"private"` - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` Wiki bool `json:"wiki"` Milestones bool `json:"milestones"` Labels bool `json:"labels"` diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 4eb20d297f203..c1e9cb3197c0b 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -34,7 +34,7 @@ type CreateRepoForm struct { UID int64 `binding:"Required"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` Private bool - Description string `binding:"MaxSize(255)"` + Description string `binding:"MaxSize(2048)"` DefaultBranch string `binding:"GitRefName;MaxSize(100)"` AutoInit bool Gitignores string @@ -76,7 +76,7 @@ type MigrateRepoForm struct { LFS bool `json:"lfs"` LFSEndpoint string `json:"lfs_endpoint"` Private bool `json:"private"` - Description string `json:"description" binding:"MaxSize(255)"` + Description string `json:"description" binding:"MaxSize(2048)"` Wiki bool `json:"wiki"` Milestones bool `json:"milestones"` Labels bool `json:"labels"` @@ -116,8 +116,8 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err // RepoSettingForm form for changing repository settings type RepoSettingForm struct { RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` - Description string `binding:"MaxSize(255)"` - Website string `binding:"ValidUrl;MaxSize(255)"` + Description string `binding:"MaxSize(2048)"` + Website string `binding:"ValidUrl;MaxSize(1024)"` Interval string MirrorAddress string MirrorUsername string diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index f23bb597894ae..0214df4514920 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -42,11 +42,11 @@ {{end}}
- +
- +