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:
wxiaoguang
2026-08-19 20:50:06 +08:00
committed by GitHub
parent c121f02a7e
commit f261adb53f
17 changed files with 21 additions and 71 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ type WikiPageMetaData struct {
// CreateWikiPageOptions form for creating wiki
type CreateWikiPageOptions struct {
// page title. leave empty to keep unchanged
Title string `json:"title"`
Title string `json:"title" binding:"TrimSpace;Required"`
// content must be base64 encoded
ContentBase64 string `json:"content_base64"`
// optional commit message summarizing the change