forked from TrueCloudLab/frostfs-node
[#58] object/put: Validate payload content after filling
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>support/v0.27
parent
2abb03dbd1
commit
6eb353c804
|
@ -21,6 +21,8 @@ type distributedTarget struct {
|
|||
chunks [][]byte
|
||||
|
||||
nodeTargetInitializer func(*network.Address) transformer.ObjectTarget
|
||||
|
||||
fmt *object.FormatValidator
|
||||
}
|
||||
|
||||
var errIncompletePut = errors.New("incomplete object put")
|
||||
|
@ -57,6 +59,10 @@ func (t *distributedTarget) Close() (*transformer.AccessIdentifiers, error) {
|
|||
payload = append(payload, t.chunks[i]...)
|
||||
}
|
||||
|
||||
if err := t.fmt.ValidateContent(t.obj.GetType(), payload); err != nil {
|
||||
return nil, errors.Wrapf(err, "(%T) could not validate payload content", t)
|
||||
}
|
||||
|
||||
t.obj.SetPayload(payload)
|
||||
|
||||
loop:
|
||||
|
|
Loading…
Reference in New Issue