diff --git a/error.go b/error.go index 8a59913be8..454f75f50e 100644 --- a/error.go +++ b/error.go @@ -129,7 +129,20 @@ func isMovedError(err error) (moved bool, ask bool, addr string) { if ind == -1 { return false, false, "" } + addr = s[ind+1:] + ind = strings.LastIndex(addr, ":") + if ind == -1 { + return false, false, "" + } + + h := addr[:ind] + p := addr[ind+1:] + if strings.HasSuffix(h, "]") { + return + } + + addr = net.JoinHostPort(h, p) return }