From 47fc10a869de552415f8dfe4734a28e8c5489269 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Sun, 13 Jun 2021 14:32:13 +0300 Subject: [PATCH] [#65] Using containerList falls back Looking container up using the owner list if its name is not cid Signed-off-by: Denis Kirillov --- api/layer/layer.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/layer/layer.go b/api/layer/layer.go index db112649..ee4ff481 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -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)