diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index 825de3b8e5bd..9e594e7ac1d5 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -267,13 +267,14 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro return errors.Wrapf(err, "checking if %s is directory", hostpath) } if !isDir { - if vmpath == "" { + vmdir := vmpath + if vmdir == "" { rPath, err := filepath.Rel(basedir, hostpath) if err != nil { return errors.Wrap(err, "generating relative path") } rPath = filepath.Dir(rPath) - vmpath = filepath.Join("/", rPath) + vmdir = filepath.Join("/", rPath) } permString := fmt.Sprintf("%o", info.Mode().Perm()) // The conversion will strip the leading 0 if present, so add it back @@ -282,7 +283,7 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro permString = fmt.Sprintf("0%s", permString) } - f, err := NewFileAsset(hostpath, vmpath, filepath.Base(hostpath), permString) + f, err := NewFileAsset(hostpath, vmdir, filepath.Base(hostpath), permString) if err != nil { return errors.Wrapf(err, "creating file asset for %s", hostpath) }