mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-19 12:20:53 +00:00
Limit length of repo description and repo url input fields (#21119)
Both allow only limited characters. If you input more, you will get a error message. So it make sense to limit the characters of the input fields. Slightly relax the MaxSize of repo's Description and Website
This commit is contained in:
parent
bdc4c4c379
commit
8351172b6e
|
@ -111,7 +111,7 @@ type CreateRepoOption struct {
|
||||||
// unique: true
|
// unique: true
|
||||||
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||||
// Description of the repository to create
|
// 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
|
// Whether the repository is private
|
||||||
Private bool `json:"private"`
|
Private bool `json:"private"`
|
||||||
// Label-Set to use
|
// Label-Set to use
|
||||||
|
@ -140,9 +140,9 @@ type EditRepoOption struct {
|
||||||
// unique: true
|
// unique: true
|
||||||
Name *string `json:"name,omitempty" binding:"OmitEmpty;AlphaDashDot;MaxSize(100);"`
|
Name *string `json:"name,omitempty" binding:"OmitEmpty;AlphaDashDot;MaxSize(100);"`
|
||||||
// a short description of the repository.
|
// 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.
|
// 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.
|
// 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
|
// 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.
|
// 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
|
// Default branch of the new repository
|
||||||
DefaultBranch string `json:"default_branch"`
|
DefaultBranch string `json:"default_branch"`
|
||||||
// Description of the repository to create
|
// 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
|
// Whether the repository is private
|
||||||
Private bool `json:"private"`
|
Private bool `json:"private"`
|
||||||
// include git content of default branch in template repo
|
// include git content of default branch in template repo
|
||||||
|
@ -316,7 +316,7 @@ type MigrateRepoOptions struct {
|
||||||
LFS bool `json:"lfs"`
|
LFS bool `json:"lfs"`
|
||||||
LFSEndpoint string `json:"lfs_endpoint"`
|
LFSEndpoint string `json:"lfs_endpoint"`
|
||||||
Private bool `json:"private"`
|
Private bool `json:"private"`
|
||||||
Description string `json:"description" binding:"MaxSize(255)"`
|
Description string `json:"description" binding:"MaxSize(2048)"`
|
||||||
Wiki bool `json:"wiki"`
|
Wiki bool `json:"wiki"`
|
||||||
Milestones bool `json:"milestones"`
|
Milestones bool `json:"milestones"`
|
||||||
Labels bool `json:"labels"`
|
Labels bool `json:"labels"`
|
||||||
|
|
|
@ -34,7 +34,7 @@ type CreateRepoForm struct {
|
||||||
UID int64 `binding:"Required"`
|
UID int64 `binding:"Required"`
|
||||||
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||||
Private bool
|
Private bool
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `binding:"MaxSize(2048)"`
|
||||||
DefaultBranch string `binding:"GitRefName;MaxSize(100)"`
|
DefaultBranch string `binding:"GitRefName;MaxSize(100)"`
|
||||||
AutoInit bool
|
AutoInit bool
|
||||||
Gitignores string
|
Gitignores string
|
||||||
|
@ -76,7 +76,7 @@ type MigrateRepoForm struct {
|
||||||
LFS bool `json:"lfs"`
|
LFS bool `json:"lfs"`
|
||||||
LFSEndpoint string `json:"lfs_endpoint"`
|
LFSEndpoint string `json:"lfs_endpoint"`
|
||||||
Private bool `json:"private"`
|
Private bool `json:"private"`
|
||||||
Description string `json:"description" binding:"MaxSize(255)"`
|
Description string `json:"description" binding:"MaxSize(2048)"`
|
||||||
Wiki bool `json:"wiki"`
|
Wiki bool `json:"wiki"`
|
||||||
Milestones bool `json:"milestones"`
|
Milestones bool `json:"milestones"`
|
||||||
Labels bool `json:"labels"`
|
Labels bool `json:"labels"`
|
||||||
|
@ -116,8 +116,8 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err
|
||||||
// RepoSettingForm form for changing repository settings
|
// RepoSettingForm form for changing repository settings
|
||||||
type RepoSettingForm struct {
|
type RepoSettingForm struct {
|
||||||
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `binding:"MaxSize(2048)"`
|
||||||
Website string `binding:"ValidUrl;MaxSize(255)"`
|
Website string `binding:"ValidUrl;MaxSize(1024)"`
|
||||||
Interval string
|
Interval string
|
||||||
MirrorAddress string
|
MirrorAddress string
|
||||||
MirrorUsername string
|
MirrorUsername string
|
||||||
|
|
|
@ -42,11 +42,11 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
<div class="field {{if .Err_Description}}error{{end}}">
|
<div class="field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{$.locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{$.locale.Tr "repo.repo_desc"}}</label>
|
||||||
<textarea id="description" name="description" rows="2">{{.Repository.Description}}</textarea>
|
<textarea id="description" name="description" rows="2" maxlength="2048">{{.Repository.Description}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="field {{if .Err_Website}}error{{end}}">
|
<div class="field {{if .Err_Website}}error{{end}}">
|
||||||
<label for="website">{{.locale.Tr "repo.settings.site"}}</label>
|
<label for="website">{{.locale.Tr "repo.settings.site"}}</label>
|
||||||
<input id="website" name="website" type="url" value="{{.Repository.Website}}">
|
<input id="website" name="website" type="url" maxlength="1024" value="{{.Repository.Website}}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
Loading…
Reference in a new issue