enhance: Improve validation errors for secrets/variables (#39221)

Signed-off-by: Ross Golder <ross@golder.org>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Ross Golder
2026-09-04 00:28:58 +00:00
committed by GitHub
co-authored by wxiaoguang
parent ce2fd8d882
commit 2d3ad4a530
19 changed files with 148 additions and 218 deletions
+1 -6
View File
@@ -5,7 +5,6 @@
package admin
import (
"errors"
"net/http"
system_model "gitea.dev/models/system"
@@ -161,11 +160,7 @@ loop:
err := validateConfigKeyValue(key, value)
if err != nil {
if errors.Is(err, util.ErrInvalidArgument) {
ctx.JSONError(err.Error())
} else {
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
}
ctx.JSONErrorAuto(err)
break loop
}
configSettings[key] = value