From bd66664706b8f3442f194f5a4359b401caa232bd Mon Sep 17 00:00:00 2001 From: Matt Calhoun Date: Mon, 3 Feb 2025 21:52:59 -0500 Subject: [PATCH] update artifactory store to use getKey (#1017) * update artifactory store to use getKey * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- pkg/store/artifactory_store.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/store/artifactory_store.go b/pkg/store/artifactory_store.go index d4fa83cd2..522430c15 100644 --- a/pkg/store/artifactory_store.go +++ b/pkg/store/artifactory_store.go @@ -89,7 +89,6 @@ func NewArtifactoryStore(options ArtifactoryStoreOptions) (Store, error) { SetOverallRequestTimeout(1 * time.Minute). SetHttpRetries(0). Build() - if err != nil { return nil, err } @@ -112,15 +111,9 @@ func (s *ArtifactoryStore) getKey(stack string, component string, key string) (s return "", fmt.Errorf("stack delimiter is not set") } - stackParts := strings.Split(stack, *s.stackDelimiter) - componentParts := strings.Split(component, "/") - - parts := []string{s.repoName, s.prefix} - parts = append(parts, stackParts...) - parts = append(parts, componentParts...) - parts = append(parts, key) - - return strings.ReplaceAll(strings.Join(parts, "/"), "//", "/"), nil + prefixParts := []string{s.repoName, s.prefix} + prefix := strings.Join(prefixParts, "/") + return getKey(prefix, *s.stackDelimiter, stack, component, key, "/") } func (s *ArtifactoryStore) Get(stack string, component string, key string) (interface{}, error) {