diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-05-28 16:44:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-28 16:44:58 +0200 |
commit | 7b6dac300d91a8634e3180fcc71213fb825974e3 (patch) | |
tree | 917c23b3509dcecbef953812efb7a2d7a332539d /cmd/podman | |
parent | 335a1ef1606734e4735a810e839032297cc89060 (diff) | |
parent | bb7b0aad0eb7874c97911d8a27532100f1a32232 (diff) | |
download | podman-7b6dac300d91a8634e3180fcc71213fb825974e3.tar.gz podman-7b6dac300d91a8634e3180fcc71213fb825974e3.tar.bz2 podman-7b6dac300d91a8634e3180fcc71213fb825974e3.zip |
Merge pull request #3194 from QiWang19/cptar
fix bug dest path of copying tar
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/cp.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go index 4cb8a8c54..8240cc193 100644 --- a/cmd/podman/cp.go +++ b/cmd/podman/cp.go @@ -272,6 +272,10 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch } return nil } + + if destDirIsExist || strings.HasSuffix(dest, string(os.PathSeparator)) { + destPath = filepath.Join(destPath, filepath.Base(srcPath)) + } // Copy the file, preserving attributes. logrus.Debugf("copying %q to %q", srcPath, destPath) if err = copyFileWithTar(srcPath, destPath); err != nil { |