[#1175] metabase: Fix encoding of updated locker list

Even single locker must be encoded using `encodeList`, or subsequent
`decodeList` call will fail.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-16 18:40:39 +03:00 committed by LeL
parent 88cefa7c5f
commit 26b8e33ed7

View file

@ -74,15 +74,11 @@ func (db *DB) Lock(cnr cid.ID, locker oid.ID, locked []oid.ID) error {
} }
// update the list of lockers // update the list of lockers
if exLockers == nil {
updLockers = keyLocker
} else {
updLockers, err = encodeList(append(exLockers, keyLocker)) updLockers, err = encodeList(append(exLockers, keyLocker))
if err != nil { if err != nil {
// maybe continue for the best effort? // maybe continue for the best effort?
return fmt.Errorf("encode list of object lockers: %w", err) return fmt.Errorf("encode list of object lockers: %w", err)
} }
}
// write updated list of lockers // write updated list of lockers
err = bucketLockedContainer.Put(bucketKeysLocked[i], updLockers) err = bucketLockedContainer.Put(bucketKeysLocked[i], updLockers)