File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -72,14 +72,21 @@ function getSocketUrl(urlParts, loc) {
72
72
// all of these sock url params are optionally passed in through
73
73
// resourceQuery, so we need to fall back to the default if
74
74
// they are not provided
75
- const host = query . host || hostname ;
75
+ let host = query . host || hostname ;
76
76
const path = query . path || '/ws' ;
77
77
let portOption = query . port || port ;
78
78
79
79
if ( portOption === 'location' ) {
80
80
portOption = loc . port ;
81
81
}
82
82
83
+ // In case the host is a raw IPv6 address, it can be enclosed in
84
+ // the brackets as the brackets are needed in the final URL string.
85
+ // Need to remove those as url.format blindly adds its own set of brackets
86
+ // if the host string contains colons. That would lead to non-working
87
+ // double brackets (e.g. [[::]]) host
88
+ host = typeof host === 'string' ? host . replace ( / ^ \[ ( .* ) \] $ / , '$1' ) : host ;
89
+
83
90
return url . format ( {
84
91
protocol,
85
92
auth,
You can’t perform that action at this time.
0 commit comments