[#429] Add tree service for cors
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
7520952792
commit
8eff857e41
4 changed files with 86 additions and 4 deletions
|
@ -181,8 +181,15 @@ func (n *layer) getCORS(ctx context.Context, bkt *data.BucketInfo, sysName strin
|
|||
if cors := n.systemCache.GetCORS(systemObjectKey(bkt, sysName)); cors != nil {
|
||||
return cors, nil
|
||||
}
|
||||
ids, _, err := n.treeService.GetBucketCORS(ctx, &bkt.CID, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return nil, errors.GetAPIError(errors.ErrNoSuchCORSConfiguration)
|
||||
}
|
||||
|
||||
obj, err := n.getSystemObjectFromNeoFS(ctx, bkt, sysName)
|
||||
obj, err := n.objectGet(ctx, bkt, *ids[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue