mirror of
https://github.com/waku-org/go-multiaddr.git
synced 2025-02-22 11:08:11 +00:00
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.
This commit is contained in:
parent
1b2246d7be
commit
d66032c340
@ -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))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user