forked from TrueCloudLab/frostfs-s3-gw
[#544] internal/neofs: Prevent potential NPE-panic in DeleteContainer
Session token parameter of `NeoFS.DeleteContainer` method is optional and can be `nil`. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
028a152e04
commit
4fe833164e
1 changed files with 4 additions and 1 deletions
|
@ -207,9 +207,12 @@ func (x *NeoFS) ContainerEACL(ctx context.Context, id cid.ID) (*eacl.Table, erro
|
||||||
func (x *NeoFS) DeleteContainer(ctx context.Context, id cid.ID, token *session.Container) error {
|
func (x *NeoFS) DeleteContainer(ctx context.Context, id cid.ID, token *session.Container) error {
|
||||||
var prm pool.PrmContainerDelete
|
var prm pool.PrmContainerDelete
|
||||||
prm.SetContainerID(id)
|
prm.SetContainerID(id)
|
||||||
prm.SetSessionToken(*token)
|
|
||||||
prm.SetWaitParams(x.await)
|
prm.SetWaitParams(x.await)
|
||||||
|
|
||||||
|
if token != nil {
|
||||||
|
prm.SetSessionToken(*token)
|
||||||
|
}
|
||||||
|
|
||||||
err := x.pool.DeleteContainer(ctx, prm)
|
err := x.pool.DeleteContainer(ctx, prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("delete container via connection pool: %w", err)
|
return fmt.Errorf("delete container via connection pool: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue