Prevent exec of value vldt/san/fmt on val. expr fields
This commit is contained in:
parent
b739c5d01f
commit
8296e48f89
@ -38,6 +38,11 @@ func (f formatter) Run(m *types.Module, vv types.RecordValueSet) types.RecordVal
|
||||
continue
|
||||
}
|
||||
|
||||
if fld.Expressions.ValueExpr != "" {
|
||||
// do not do any validation if field has value expression!
|
||||
continue
|
||||
}
|
||||
|
||||
if !(fld.Expressions.DisableDefaultFormatters && len(fld.Expressions.Formatters) > 0) {
|
||||
// Per field type validators
|
||||
switch strings.ToLower(fld.Kind) {
|
||||
|
||||
@ -73,6 +73,11 @@ func (s sanitizer) Run(m *types.Module, vv types.RecordValueSet) (out types.Reco
|
||||
continue
|
||||
}
|
||||
|
||||
if f.Expressions.ValueExpr != "" {
|
||||
// do not do any sanitization if field has value expression!
|
||||
continue
|
||||
}
|
||||
|
||||
if v.IsDeleted() || !v.Updated {
|
||||
// Ignore unchanged and deleted
|
||||
continue
|
||||
|
||||
@ -145,6 +145,11 @@ fields:
|
||||
continue
|
||||
}
|
||||
|
||||
if f.Expressions.ValueExpr != "" {
|
||||
// do not do any validation if field has value expression!
|
||||
continue
|
||||
}
|
||||
|
||||
if !(f.Expressions.DisableDefaultValidators && len(f.Expressions.Validators) > 0) {
|
||||
if v.Value == "" {
|
||||
// Nothing to do with empty value
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user