diff --git a/pkg/transportrequest/cts/upload.go b/pkg/transportrequest/cts/upload.go index fb22b4260e..a50458df70 100644 --- a/pkg/transportrequest/cts/upload.go +++ b/pkg/transportrequest/cts/upload.go @@ -2,10 +2,12 @@ package cts import ( "fmt" + "regexp" + "strings" + "github.com/SAP/jenkins-library/pkg/command" "github.com/SAP/jenkins-library/pkg/log" "github.com/SAP/jenkins-library/pkg/piperutils" - "strings" ) type fileUtils interface { @@ -60,6 +62,7 @@ const ( abapUserKey = "ABAP_USER" abapPasswordKey = "ABAP_PASSWORD" defaultConfigFileName = "ui5-deploy.yaml" + pattern = "^[a-zA-Z0-9_]+$" ) // WithConnection ... @@ -189,6 +192,10 @@ func getFioriDeployStatement( log.Entry().Debug("No application package found in piper config.") } if len(app.Name) > 0 { + re := regexp.MustCompile(pattern) + if !re.MatchString(app.Name) { + fmt.Errorf("application name '%s' contains spaces or special characters. It is not according to the '%s'", app.Name, pattern) + } log.Entry().Debugf("application name '%s' used from piper config", app.Name) cmd = append(cmd, "--name", app.Name) } else {