diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-19 15:51:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 15:51:20 +0200 |
commit | dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e (patch) | |
tree | 3039b25f051e891d0717be53b856410a3b98c657 /pkg/systemd/generate/common.go | |
parent | 45b3d61c5550f8a998f2117c52b26e53955ba56a (diff) | |
parent | b1ffa2324eaf3e3d847ce4e0f738d6bf9e46a54b (diff) | |
download | podman-dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e.tar.gz podman-dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e.tar.bz2 podman-dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e.zip |
Merge pull request #7350 from vrothberg/fix-7285
generate systemd: quote arguments with whitespace
Diffstat (limited to 'pkg/systemd/generate/common.go')
-rw-r--r-- | pkg/systemd/generate/common.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go index d6d18a810..1fc4479ff 100644 --- a/pkg/systemd/generate/common.go +++ b/pkg/systemd/generate/common.go @@ -1,6 +1,7 @@ package generate import ( + "strconv" "strings" "github.com/pkg/errors" @@ -53,3 +54,15 @@ func filterPodFlags(command []string) []string { } return processed } + +// quoteArguments makes sure that all arguments with at least one whitespace +// are quoted to make sure those are interpreted as one argument instead of +// multiple ones. +func quoteArguments(command []string) []string { + for i := range command { + if strings.ContainsAny(command[i], " \t") { + command[i] = strconv.Quote(command[i]) + } + } + return command +} |