[#65] Using containerList falls back

Looking container up using the owner list if its name is not cid

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2021-06-13 14:32:13 +03:00
parent 4df647baac
commit 47fc10a869

View file

@ -132,7 +132,17 @@ func (n *layer) GetBucketInfo(ctx context.Context, name string) (*BucketInfo, er
containerID := new(cid.ID)
if err := containerID.Parse(name); err != nil {
return nil, err
list, err := n.containerList(ctx)
if err != nil {
return nil, err
}
for _, bkt := range list {
if bkt.Name == name {
return bkt, nil
}
}
return nil, status.Error(codes.NotFound, "bucket not found")
}
return n.containerInfo(ctx, containerID)