summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-09-25 23:38:55 +0200
committerGitHub <noreply@github.com>2019-09-25 23:38:55 +0200
commit3ed265c520eb4cea1e9157125dbff0e6a1b0b5f8 (patch)
tree14852e5dcdc4b554881b3eebc49c58d079fa7069 /cmd
parent19075ca16e6b34cc7f25d3fbc0fad96b44cbfef5 (diff)
parent0144c3796ba3dd0555e35fd2cc3f76bde10a90a0 (diff)
downloadpodman-3ed265c520eb4cea1e9157125dbff0e6a1b0b5f8.tar.gz
podman-3ed265c520eb4cea1e9157125dbff0e6a1b0b5f8.tar.bz2
podman-3ed265c520eb4cea1e9157125dbff0e6a1b0b5f8.zip
Merge pull request #4101 from QiWang19/nonexistdir
fix cp none exists dest path ends with '/'
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/cp.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index 7205f9357..75a23afd6 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -290,7 +290,7 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
}
destdir := destPath
- if !srcfi.IsDir() && !strings.HasSuffix(dest, string(os.PathSeparator)) {
+ if !srcfi.IsDir() {
destdir = filepath.Dir(destPath)
}
_, err = os.Stat(destdir)
@@ -329,7 +329,7 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
destfi, err := os.Stat(destPath)
if err != nil {
- if !os.IsNotExist(err) {
+ if !os.IsNotExist(err) || strings.HasSuffix(dest, string(os.PathSeparator)) {
return errors.Wrapf(err, "failed to get stat of dest path %s", destPath)
}
}