mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-22 16:03:32 +00:00
chore: form binding trim space (#38978)
Use "binding:TrimSpace" instead of fragile IsEmptyString And fix a bug in locale's `HasKey`: it should also try the default language if current language doesn't have the translation key, a new test is added.
This commit is contained in:
@@ -612,10 +612,6 @@ func EditProject(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
form := web.GetForm[*api.EditProjectOption](ctx)
|
||||
if form.Title != nil && util.IsEmptyString(*form.Title) {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "title must not be empty")
|
||||
return
|
||||
}
|
||||
opts := project_service.UpdateProjectOptions{
|
||||
Title: optional.FromPtr(form.Title),
|
||||
Description: optional.FromPtr(form.Description),
|
||||
@@ -1187,10 +1183,6 @@ func EditProjectColumn(ctx *context.APIContext) {
|
||||
|
||||
form := web.GetForm[*api.EditProjectColumnOption](ctx)
|
||||
if form.Title != nil {
|
||||
if util.IsEmptyString(*form.Title) {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "title must not be empty")
|
||||
return
|
||||
}
|
||||
column.Title = *form.Title
|
||||
}
|
||||
if form.Color != nil {
|
||||
|
||||
Reference in New Issue
Block a user