Skip to content

Commit

Permalink
docker cp: prevent NPE when failing to stat destination
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 585ec4da977058ee312140ac6fe1bbeea32fc841
Component: cli
  • Loading branch information
thaJeztah committed Dec 9, 2019
1 parent 74f3d40 commit c1f9681
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/cli/cli/command/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c1f9681

Please sign in to comment.