Merge pull request #2222 from thaJeztah/19.03_backport_fix_docker_cp_npe
[19.03 backport] docker cp: prevent NPE when failing to stat destination
This commit is contained in:
@ -139,6 +139,10 @@ func ValidateOutputPath(path string) error {
|
||||
// check whether `path` points to a regular file
|
||||
// (if the path exists and doesn't point to a directory)
|
||||
if fileInfo, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if fileInfo.Mode().IsDir() || fileInfo.Mode().IsRegular() {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user