Files
gitea/modules/structs/form.go
T
wxiaoguangandGitHub 6904f6480c refactor: http request binding (#38971)
Better than before, still not good enough (more work can be done in the
future)

And add the missing error handling in the PrivateContext "bind"
middleware.

By the way, picked some "TrimSpace" changes from "fix: trim whitespace
from SMTP address and port - #38934" (fix #38926)
2026-08-19 14:15:42 +08:00

23 lines
626 B
Go

// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
import (
"gitea.dev/modules/translation/i18n"
"gitea.com/go-chi/binding" //nolint:depguard // avoid cycle import
)
// ValidateContext is a special context for form validation middleware
type ValidateContext struct {
Locale i18n.LocaleTranslation
}
type FormDefaultValidator struct{}
func (FormDefaultValidator) Validate(ctx *ValidateContext, errs binding.Errors) binding.Errors {
// this default validator only needs to return the errs as is because the "binding" function has already validated
return errs
}