mirror of https://github.com/docker/cli.git
docker cp: prevent NPE when failing to stat destination
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
8547dfcff7
commit
585ec4da97
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue