[#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,8 +132,18 @@ func (n *layer) GetBucketInfo(ctx context.Context, name string) (*BucketInfo, er
containerID := new(cid.ID) containerID := new(cid.ID)
if err := containerID.Parse(name); err != nil { if err := containerID.Parse(name); err != nil {
list, err := n.containerList(ctx)
if err != nil {
return nil, err 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) return n.containerInfo(ctx, containerID)
} }