mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-20 02:19:45 +09:00
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)
23 lines
626 B
Go
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
|
|
}
|