aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-19 12:51:23 -0500
committerGitHub <noreply@github.com>2021-02-19 12:51:23 -0500
commit4d64dd2d60cf468d52987690728cf7f3bc445cce (patch)
tree64b61c1bdbfa84528b3380b75055647bbfa5d461 /cmd
parent7e286bc430ea50b72e972e48626298ac2e1f258a (diff)
parenta3c8782998140d4203a71fd0cdded9fde55550eb (diff)
downloadpodman-4d64dd2d60cf468d52987690728cf7f3bc445cce.tar.gz
podman-4d64dd2d60cf468d52987690728cf7f3bc445cce.tar.bz2
podman-4d64dd2d60cf468d52987690728cf7f3bc445cce.zip
Merge pull request #9435 from vrothberg/3.0-cp-content-fix
[3.0] cp: treat "." and "/." correctly
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/cp.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index 69b61a06c..5db05719c 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -311,8 +311,8 @@ func copyToContainer(container string, containerPath string, hostPath string) er
}
getOptions := buildahCopiah.GetOptions{
- // Unless the specified path ends with ".", we want to copy the base directory.
- KeepDirectoryNames: !strings.HasSuffix(hostPath, "."),
+ // Unless the specified points to ".", we want to copy the base directory.
+ KeepDirectoryNames: hostInfo.IsDir && filepath.Base(hostPath) != ".",
}
if !hostInfo.IsDir && (!containerInfo.IsDir || containerInfoErr != nil) {
// If we're having a file-to-file copy, make sure to