Remove unnecessary length check for repo's Description & Website (#21194)
Follows #21119 The manual length check doesn't make sense nowadays: 1. The length check is already done by form's `binding:MaxSize` (then the manual check is unnecessary) 2. The CreateRepository doesn't have such check (then the manual check is inconsistent) So this PR removes these manual length checks.
This commit is contained in:
parent
321964155a
commit
395f65c65a
1 changed files with 0 additions and 8 deletions
|
@ -10,7 +10,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
activities_model "code.gitea.io/gitea/models/activities"
|
activities_model "code.gitea.io/gitea/models/activities"
|
||||||
|
@ -337,13 +336,6 @@ func CheckDaemonExportOK(ctx context.Context, repo *repo_model.Repository) error
|
||||||
func UpdateRepository(ctx context.Context, repo *repo_model.Repository, visibilityChanged bool) (err error) {
|
func UpdateRepository(ctx context.Context, repo *repo_model.Repository, visibilityChanged bool) (err error) {
|
||||||
repo.LowerName = strings.ToLower(repo.Name)
|
repo.LowerName = strings.ToLower(repo.Name)
|
||||||
|
|
||||||
if utf8.RuneCountInString(repo.Description) > 255 {
|
|
||||||
repo.Description = string([]rune(repo.Description)[:255])
|
|
||||||
}
|
|
||||||
if utf8.RuneCountInString(repo.Website) > 255 {
|
|
||||||
repo.Website = string([]rune(repo.Website)[:255])
|
|
||||||
}
|
|
||||||
|
|
||||||
e := db.GetEngine(ctx)
|
e := db.GetEngine(ctx)
|
||||||
|
|
||||||
if _, err = e.ID(repo.ID).AllCols().Update(repo); err != nil {
|
if _, err = e.ID(repo.ID).AllCols().Update(repo); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue