summaryrefslogtreecommitdiff
path: root/pkg/specgen/volumes.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-17 19:05:42 +0000
committerGitHub <noreply@github.com>2021-08-17 19:05:42 +0000
commita7a55ea7fb18bdcda8c310fadcacb77dd2a9e90a (patch)
tree3bb2ab6ca5c946979026e16589959cdb0180a858 /pkg/specgen/volumes.go
parent7abc8d40d01541766387b61893b3ec80770556a6 (diff)
parent1f632f35727f91558049d3b7ee78d9952c8bddb2 (diff)
downloadpodman-a7a55ea7fb18bdcda8c310fadcacb77dd2a9e90a.tar.gz
podman-a7a55ea7fb18bdcda8c310fadcacb77dd2a9e90a.tar.bz2
podman-a7a55ea7fb18bdcda8c310fadcacb77dd2a9e90a.zip
Merge pull request #11231 from flouthoc/move-volume-dest-to-server
volume: move validating volume dest from client to server.
Diffstat (limited to 'pkg/specgen/volumes.go')
-rw-r--r--pkg/specgen/volumes.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go
index d85d2bdd1..eca8c0c35 100644
--- a/pkg/specgen/volumes.go
+++ b/pkg/specgen/volumes.go
@@ -1,7 +1,6 @@
package specgen
import (
- "path/filepath"
"strings"
"github.com/containers/common/pkg/parse"
@@ -93,11 +92,6 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
return nil, nil, nil, errors.New("host directory cannot be empty")
}
}
- if err := parse.ValidateVolumeCtrDir(dest); err != nil {
- return nil, nil, nil, err
- }
-
- cleanDest := filepath.Clean(dest)
if strings.HasPrefix(src, "/") || strings.HasPrefix(src, ".") {
// This is not a named volume
@@ -120,7 +114,7 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
if overlayFlag {
// This is a overlay volume
newOverlayVol := new(OverlayVolume)
- newOverlayVol.Destination = cleanDest
+ newOverlayVol.Destination = dest
newOverlayVol.Source = src
newOverlayVol.Options = options
@@ -130,7 +124,7 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
overlayVolumes[newOverlayVol.Destination] = newOverlayVol
} else {
newMount := spec.Mount{
- Destination: cleanDest,
+ Destination: dest,
Type: "bind",
Source: src,
Options: options,
@@ -144,7 +138,7 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
// This is a named volume
newNamedVol := new(NamedVolume)
newNamedVol.Name = src
- newNamedVol.Dest = cleanDest
+ newNamedVol.Dest = dest
newNamedVol.Options = options
if _, ok := volumes[newNamedVol.Dest]; ok {