From 9279fcf4aeb860b3c50f92a79b569bba43ff6979 Mon Sep 17 00:00:00 2001 From: Leandro Poroli Date: Tue, 24 Oct 2023 11:45:20 -0500 Subject: [PATCH] PR review changes --- .../docker_label_key/docker_label_key.go | 4 +++- .../kubernetes_label_key/kubernetes_label_key.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key/docker_label_key.go b/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key/docker_label_key.go index 43ccfd92a0..06ae7d1572 100644 --- a/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key/docker_label_key.go +++ b/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key/docker_label_key.go @@ -3,6 +3,7 @@ package docker_label_key import ( "github.com/kurtosis-tech/stacktrace" "regexp" + "strings" ) const ( @@ -61,7 +62,8 @@ func (key *DockerLabelKey) GetString() string { } func validateNotEmptyUserCustomLabelKey(str string) error { - if str == "" || str == " " { + str = strings.TrimSpace(str) + if str == "" { return stacktrace.NewError("User custom label key can't be an empty string") } return nil diff --git a/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/kubernetes_label_key/kubernetes_label_key.go b/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/kubernetes_label_key/kubernetes_label_key.go index 0df767ff50..8efed6cbb6 100644 --- a/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/kubernetes_label_key/kubernetes_label_key.go +++ b/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/kubernetes_label_key/kubernetes_label_key.go @@ -53,7 +53,8 @@ func (key *KubernetesLabelKey) GetString() string { } func validateNotEmptyUserCustomLabelKey(str string) error { - if str == "" || str == " " { + str = strings.TrimSpace(str) + if str == "" { return stacktrace.NewError("User custom label key can't be an empty string") } return nil