From 8212ff117b17c2b231a22db2a9de7defaca089ad Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 5 Jul 2023 17:40:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=87=8D=E5=90=8D?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=20(#1550?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/container.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 797ff1e9d..14fc6fdc2 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -287,7 +287,7 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error { } ctx := context.Background() newContainer, _ := client.ContainerInspect(ctx, req.Name) - if len(newContainer.ID) != 0 { + if newContainer.ContainerJSONBase != nil { return buserr.New(constant.ErrContainerName) } @@ -378,7 +378,7 @@ func (u *ContainerService) ContainerUpdate(req dto.ContainerOperate) error { } ctx := context.Background() newContainer, _ := client.ContainerInspect(ctx, req.Name) - if len(newContainer.ID) != 0 && newContainer.ID != req.ContainerID { + if newContainer.ContainerJSONBase != nil && newContainer.ID != req.ContainerID { return buserr.New(constant.ErrContainerName) } @@ -471,7 +471,7 @@ func (u *ContainerService) ContainerOperation(req dto.ContainerOperation) error err = client.ContainerUnpause(ctx, req.Name) case constant.ContainerOpRename: newContainer, _ := client.ContainerInspect(ctx, req.NewName) - if len(newContainer.ID) != 0 { + if newContainer.ContainerJSONBase != nil { return buserr.New(constant.ErrContainerName) } err = client.ContainerRename(ctx, req.Name, req.NewName)