1
0
mirror of https://github.com/docker/cli.git synced 2025-09-03 21:22:02 +03:00

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>
This commit is contained in:
Ahmet Alp Balkan
2014-10-29 15:46:45 -07:00
committed by Vincent Demeester
parent 4731b1ebc8
commit bcae148da2

View File

@@ -5,7 +5,7 @@ import (
"net"
"net/url"
"os"
"path/filepath"
"path"
"regexp"
"strings"
@@ -151,13 +151,13 @@ func ValidatePath(val string) (string, error) {
splited := strings.SplitN(val, ":", 2)
if len(splited) == 1 {
containerPath = splited[0]
val = filepath.Clean(splited[0])
val = path.Clean(splited[0])
} else {
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, nil