浏览代码

Fix input volume path check on Windows

used path package instead of path/filepath so that --volumes and
--device parameters to always validate paths as unix paths instead of
OS-dependent path convention

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Ahmet Alp Balkan 10 年之前
父节点
当前提交
5a38680bd2
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      opts/opts.go

+ 4 - 4
opts/opts.go

@@ -5,7 +5,7 @@ import (
 	"net"
 	"net"
 	"net/url"
 	"net/url"
 	"os"
 	"os"
-	"path/filepath"
+	"path"
 	"regexp"
 	"regexp"
 	"strings"
 	"strings"
 
 
@@ -151,13 +151,13 @@ func ValidatePath(val string) (string, error) {
 	splited := strings.SplitN(val, ":", 2)
 	splited := strings.SplitN(val, ":", 2)
 	if len(splited) == 1 {
 	if len(splited) == 1 {
 		containerPath = splited[0]
 		containerPath = splited[0]
-		val = filepath.Clean(splited[0])
+		val = path.Clean(splited[0])
 	} else {
 	} else {
 		containerPath = splited[1]
 		containerPath = splited[1]
-		val = fmt.Sprintf("%s:%s", splited[0], filepath.Clean(splited[1]))
+		val = fmt.Sprintf("%s:%s", splited[0], path.Clean(splited[1]))
 	}
 	}
 
 
-	if !filepath.IsAbs(containerPath) {
+	if !path.IsAbs(containerPath) {
 		return val, fmt.Errorf("%s is not an absolute path", containerPath)
 		return val, fmt.Errorf("%s is not an absolute path", containerPath)
 	}
 	}
 	return val, nil
 	return val, nil