diff --git a/api/http/handler/docker/images/images_list.go b/api/http/handler/docker/images/images_list.go index 623bd39e1..b9995e5c2 100644 --- a/api/http/handler/docker/images/images_list.go +++ b/api/http/handler/docker/images/images_list.go @@ -78,7 +78,7 @@ func (handler *Handler) imagesList(w http.ResponseWriter, r *http.Request) *http imagesList := make([]ImageResponse, len(images)) for i, image := range images { - if (image.RepoTags == nil || len(image.RepoTags) == 0) && (image.RepoDigests != nil && len(image.RepoDigests) > 0) { + if len(image.RepoTags) == 0 && len(image.RepoDigests) > 0 { for _, repoDigest := range image.RepoDigests { image.RepoTags = append(image.RepoTags, repoDigest[0:strings.Index(repoDigest, "@")]+":") } diff --git a/api/stacks/stackutils/validation.go b/api/stacks/stackutils/validation.go index 83850497e..5235a440e 100644 --- a/api/stacks/stackutils/validation.go +++ b/api/stacks/stackutils/validation.go @@ -48,11 +48,11 @@ func IsValidStackFile(stackFileContent []byte, securitySettings *portainer.Endpo return errors.New("pid host disabled for non administrator users") } - if !securitySettings.AllowDeviceMappingForRegularUsers && service.Devices != nil && len(service.Devices) > 0 { + if !securitySettings.AllowDeviceMappingForRegularUsers && len(service.Devices) > 0 { return errors.New("device mapping disabled for non administrator users") } - if !securitySettings.AllowSysctlSettingForRegularUsers && service.Sysctls != nil && len(service.Sysctls) > 0 { + if !securitySettings.AllowSysctlSettingForRegularUsers && len(service.Sysctls) > 0 { return errors.New("sysctl setting disabled for non administrator users") }