From 4591af60eee1d9d8bb36420e74194179ee735e5e Mon Sep 17 00:00:00 2001 From: "Yuan (Terry) Tang" Date: Wed, 13 Sep 2023 16:34:21 -0400 Subject: [PATCH] fix: Only append slash when missing for Artifactory repoURL (#11812) Signed-off-by: Yuan Tang --- pkg/apis/workflow/v1alpha1/artifact_repository_types.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/apis/workflow/v1alpha1/artifact_repository_types.go b/pkg/apis/workflow/v1alpha1/artifact_repository_types.go index e0bad710cd7f..8c2ae9945b24 100644 --- a/pkg/apis/workflow/v1alpha1/artifact_repository_types.go +++ b/pkg/apis/workflow/v1alpha1/artifact_repository_types.go @@ -3,6 +3,7 @@ package v1alpha1 import ( "fmt" "path" + "strings" ) var ( @@ -131,9 +132,9 @@ type ArtifactoryArtifactRepository struct { } func (r *ArtifactoryArtifactRepository) IntoArtifactLocation(l *ArtifactLocation) { - url := "" - if r.RepoURL != "" { - url = r.RepoURL + "/" + url := r.RepoURL + if !strings.HasSuffix(url, "/") { + url = url + "/" } k := r.KeyFormat if k == "" {