From c60fabe5e8a156191e0746d997eb19007484020c Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Mon, 8 Mar 2021 17:07:38 -0800 Subject: [PATCH] Fix unnecessary slash path joining that doesn't work on Windows --- pkg/util/util.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/util/util.go b/pkg/util/util.go index 7e5b79a3fa..cab775e089 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -20,8 +20,6 @@ import ( "fmt" "net/url" "os" - "path" - "path/filepath" "strings" csi "github.com/container-storage-interface/spec/lib/go/csi" @@ -59,13 +57,13 @@ func ParseEndpoint(endpoint string) (string, string, error) { return "", "", fmt.Errorf("could not parse endpoint: %v", err) } - addr := path.Join(u.Host, filepath.FromSlash(u.Path)) + addr := u.Path scheme := strings.ToLower(u.Scheme) switch scheme { case "tcp": + addr = u.Host case "unix": - addr = path.Join("/", addr) if err := os.Remove(addr); err != nil && !os.IsNotExist(err) { return "", "", fmt.Errorf("could not remove unix domain socket %q: %v", addr, err) }