From e99b4f1380d6700520d516a81e4562902b4814c7 Mon Sep 17 00:00:00 2001 From: Stephen Barker Date: Fri, 17 Mar 2023 16:50:41 -0400 Subject: [PATCH] Enclose exported environment variable values with quotes, fixes #3499 (#4594) --- pkg/ddevapp/provider.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/ddevapp/provider.go b/pkg/ddevapp/provider.go index b18f2179e40..849916c5b88 100644 --- a/pkg/ddevapp/provider.go +++ b/pkg/ddevapp/provider.go @@ -1,14 +1,13 @@ package ddevapp import ( + "fmt" "github.com/ddev/ddev/pkg/output" "os" "path" "path/filepath" "strings" - "fmt" - "github.com/ddev/ddev/pkg/fileutil" "github.com/ddev/ddev/pkg/util" @@ -438,8 +437,9 @@ func (p *Provider) Validate() error { func (p *Provider) injectedEnvironment() string { s := "true" if len(p.EnvironmentVariables) > 0 { - s = "export " + s = "export" for k, v := range p.EnvironmentVariables { + v = strings.Replace(v, " ", `\ `, -1) s = s + fmt.Sprintf(" %s=%s ", k, v) } }