forked from TrueCloudLab/frostfs-node
[#57] core/object: Fix validation of linking object
Linking object carries only identifier of the parent object. Fix Validate method of FormatValidator to not validate parent object of the linking object. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
be322835af
commit
68178b8d74
1 changed files with 12 additions and 7 deletions
|
@ -35,14 +35,19 @@ func (v *FormatValidator) Validate(obj *Object) error {
|
||||||
return errNilCID
|
return errNilCID
|
||||||
}
|
}
|
||||||
|
|
||||||
for ; obj.GetID() != nil; obj = NewFromSDK(obj.GetParent()) {
|
if err := v.validateSignatureKey(obj); err != nil {
|
||||||
if err := v.validateSignatureKey(obj); err != nil {
|
return errors.Wrapf(err, "(%T) could not validate signature key", v)
|
||||||
return errors.Wrapf(err, "(%T) could not validate signature key", v)
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if err := object.CheckHeaderVerificationFields(obj.SDK()); err != nil {
|
if err := object.CheckHeaderVerificationFields(obj.SDK()); err != nil {
|
||||||
return errors.Wrapf(err, "(%T) could not validate header fields", v)
|
return errors.Wrapf(err, "(%T) could not validate header fields", v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
par := NewFromSDK(obj.GetParent())
|
||||||
|
|
||||||
|
// validate parent object header
|
||||||
|
if par.GetID() != nil && len(obj.GetChildren()) == 0 {
|
||||||
|
return v.Validate(par)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue