Skip to content

Commit d66032c

Browse files
committed
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.
1 parent 1b2246d commit d66032c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

convert.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func DialArgs(m ma.Multiaddr) (string, string, error) {
192192
}
193193
return network, "[" + ip + "]" + ":" + port, nil
194194
case "unix":
195-
return network, ip, nil
195+
return network, filepath.FromSlash(ip), nil
196196
default:
197197
return "", "", fmt.Errorf("%s is not a 'thin waist' address", m)
198198
}
@@ -263,6 +263,6 @@ func parseUnixNetAddr(a net.Addr) (ma.Multiaddr, error) {
263263
if !ok {
264264
return nil, errIncorrectNetAddr
265265
}
266-
cleaned := filepath.Clean(ac.Name)
267-
return ma.NewComponent("unix", cleaned)
266+
267+
return ma.NewComponent("unix", filepath.ToSlash(ac.Name))
268268
}

0 commit comments

Comments
 (0)