mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-18 22:36:43 +09:00
refactor: move go-chi/binding into Gitea (#39528)
The `gitea.com/go-chi/binding` package only exists for Gitea, so it moves into `modules/web/binding` to fix its bugs directly. Split out of https://github.com/go-gitea/gitea/pull/39504. - GET and HEAD always bind the query - JSON `null` slice elements and nested `TrimSpace` fields bind correctly - Integer fields reject out-of-range values instead of wrapping - An empty JSON body binds nothing and an unknown binding rule is an error Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
17 files changed
+748
-72
No files matched your search
@@ -38,7 +38,7 @@ type InstallForm struct {
|
||||
SMTPAddr string `binding:"TrimSpace"`
|
||||
SMTPPort string `binding:"TrimSpace"`
|
||||
SMTPFrom string `binding:"TrimSpace"`
|
||||
SMTPUser string `binding:"TrimSpace;OmitEmpty;MaxSize(254)" locale:"install.mailer_user"`
|
||||
SMTPUser string `binding:"TrimSpace;MaxSize(254)" locale:"install.mailer_user"`
|
||||
SMTPPasswd string
|
||||
RegisterConfirm bool
|
||||
MailNotify bool
|
||||
@@ -183,7 +183,7 @@ type AvatarForm struct {
|
||||
middleware.FormDefaultValidator
|
||||
Source string
|
||||
Avatar *multipart.FileHeader
|
||||
Gravatar string `binding:"OmitEmpty;Email;MaxSize(254)"`
|
||||
Gravatar string `binding:"Email;MaxSize(254)"`
|
||||
}
|
||||
|
||||
// AddEmailForm form for adding new email
|
||||
@@ -215,12 +215,12 @@ type AddOpenIDForm struct {
|
||||
// AddKeyForm form for adding SSH/GPG key
|
||||
type AddKeyForm struct {
|
||||
middleware.FormDefaultValidator
|
||||
Type string `binding:"OmitEmpty"`
|
||||
Type string
|
||||
Title string `binding:"Required;MaxSize(50)"`
|
||||
Content string `binding:"Required"`
|
||||
Signature string `binding:"OmitEmpty"`
|
||||
KeyID string `binding:"OmitEmpty"`
|
||||
Fingerprint string `binding:"OmitEmpty"`
|
||||
Signature string
|
||||
KeyID string
|
||||
Fingerprint string
|
||||
IsWritable bool
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user