aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/containers/cp.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/containers/cp.go')
-rw-r--r--cmd/podman/containers/cp.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index 2c7d72b20..0ad258824 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -177,6 +177,10 @@ func copyFromContainer(container string, containerPath string, hostPath string)
containerTarget = filepath.Dir(containerTarget)
}
+ if !isStdout && containerInfo.IsDir && !hostInfo.IsDir {
+ return errors.New("destination must be a directory when copying a directory")
+ }
+
reader, writer := io.Pipe()
hostCopy := func() error {
defer reader.Close()
@@ -334,6 +338,10 @@ func copyToContainer(container string, containerPath string, hostPath string) er
stdinFile = tmpFile.Name()
}
+ if hostInfo.IsDir && !containerInfo.IsDir {
+ return errors.New("destination must be a directory when copying a directory")
+ }
+
reader, writer := io.Pipe()
hostCopy := func() error {
defer writer.Close()