From 5399b92eed312bf1293b4462f847075862eab5b7 Mon Sep 17 00:00:00 2001 From: andoks Date: Thu, 31 Oct 2024 16:24:30 +0100 Subject: [PATCH] Fix configs and secrets relative target logic If target is relative it should be joined with target base, not concatenated. --- pkg/compose/secrets.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/compose/secrets.go b/pkg/compose/secrets.go index 1e1c1032c7f..06f480f5b72 100644 --- a/pkg/compose/secrets.go +++ b/pkg/compose/secrets.go @@ -25,6 +25,7 @@ import ( "io" "io/fs" "os" + "path" "path/filepath" "strconv" "time" @@ -39,7 +40,7 @@ func (s *composeService) injectSecrets(ctx context.Context, project *types.Proje if secret.Target == "" { secret.Target = secretsBaseDir + secret.Source } else if !isAbsTarget(secret.Target) { - secret.Target = secretsBaseDir + secret.Target + secret.Target = path.Join(secretsBaseDir, secret.Target) } definedSecret := project.Secrets[secret.Source] @@ -92,7 +93,7 @@ func (s *composeService) injectConfigs(ctx context.Context, project *types.Proje if config.Target == "" { config.Target = configsBaseDir + config.Source } else if !isAbsTarget(config.Target) { - config.Target = configsBaseDir + config.Target + config.Target = path.Join(configsBaseDir, config.Target) } definedConfig := project.Configs[config.Source]