[#64] core/object: Claim TombstoneContent in tombstone payload

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-01 20:14:10 +03:00 committed by Alex Vanin
parent 21bdc82fb5
commit 33ca88f85f
2 changed files with 11 additions and 6 deletions

View file

@ -89,13 +89,15 @@ func (v *FormatValidator) ValidateContent(t object.Type, payload []byte) error {
return errors.Errorf("(%T) empty payload in tombstone", v)
}
addr, err := object.AddressFromBytes(payload)
content, err := TombstoneContentFromBytes(payload)
if err != nil {
return errors.Wrapf(err, "(%T) could not parse object address from tombstone", v)
return errors.Wrapf(err, "(%T) could not parse tombstone content", err)
}
if addr.GetContainerID() == nil || addr.GetObjectID() == nil {
return errors.Errorf("(%T) empty address reference in tombstone", v)
for _, addr := range content.GetAddressList() {
if addr.GetContainerID() == nil || addr.GetObjectID() == nil {
return errors.Errorf("(%T) empty address reference in tombstone", v)
}
}
}