Commit d66032c3 authored by Steven Allen's avatar Steven Allen

fix unix path handling on windows

* Convert to windows paths when converting from a multiaddr to a net.Addr
* Convert from windows paths when converting from a net.Addr to a multiaddr

Also, don't "clean". `filepath.Clean` is _usually_ correct but not _technically_
correct in all cases. We should leave cleaning to the application.
parent 1b2246d7
......@@ -192,7 +192,7 @@ func DialArgs(m ma.Multiaddr) (string, string, error) {
}
return network, "[" + ip + "]" + ":" + port, nil
case "unix":
return network, ip, nil
return network, filepath.FromSlash(ip), nil
default:
return "", "", fmt.Errorf("%s is not a 'thin waist' address", m)
}
......@@ -263,6 +263,6 @@ func parseUnixNetAddr(a net.Addr) (ma.Multiaddr, error) {
if !ok {
return nil, errIncorrectNetAddr
}
cleaned := filepath.Clean(ac.Name)
return ma.NewComponent("unix", cleaned)
return ma.NewComponent("unix", filepath.ToSlash(ac.Name))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment