forked from TrueCloudLab/frostfs-node
[#58] object/put: Validate payload content after filling
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2abb03dbd1
commit
6eb353c804
1 changed files with 6 additions and 0 deletions
|
@ -21,6 +21,8 @@ type distributedTarget struct {
|
||||||
chunks [][]byte
|
chunks [][]byte
|
||||||
|
|
||||||
nodeTargetInitializer func(*network.Address) transformer.ObjectTarget
|
nodeTargetInitializer func(*network.Address) transformer.ObjectTarget
|
||||||
|
|
||||||
|
fmt *object.FormatValidator
|
||||||
}
|
}
|
||||||
|
|
||||||
var errIncompletePut = errors.New("incomplete object put")
|
var errIncompletePut = errors.New("incomplete object put")
|
||||||
|
@ -57,6 +59,10 @@ func (t *distributedTarget) Close() (*transformer.AccessIdentifiers, error) {
|
||||||
payload = append(payload, t.chunks[i]...)
|
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)
|
t.obj.SetPayload(payload)
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
|
|
Loading…
Reference in a new issue