From 58d157c2d8ebb3186937660cf71bb7aae5bf933f Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Sat, 15 Jul 2017 10:19:01 -0500 Subject: [PATCH] Use filepath.join to escape whitespace --- src/nvm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvm.go b/src/nvm.go index 3863487d..3f334475 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -375,7 +375,7 @@ func use(version string, cpuarch string) { // Create or update the symlink sym, _ := os.Stat(env.symlink) if sym != nil { - cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink) + cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", filepath.Clean(env.symlink)) var output bytes.Buffer var _stderr bytes.Buffer cmd.Stdout = &output @@ -387,7 +387,7 @@ func use(version string, cpuarch string) { } } - c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", env.symlink, filepath.Join(env.root, "v"+version)) + c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", filepath.Clean(env.symlink), filepath.Join(env.root, "v"+version)) var out bytes.Buffer var stderr bytes.Buffer c.Stdout = &out