mirror of https://github.com/grpc/grpc-node.git
Fix capture group numbers in parseTarget
This commit is contained in:
parent
2add1c342d
commit
b9220fdb2d
|
@ -332,10 +332,10 @@ export function parseTarget(target: string): dnsUrl | null {
|
||||||
const match = IPV4_REGEX.exec(target) ?? IPV6_REGEX.exec(target) ?? IPV6_BRACKET_REGEX.exec(target) ?? DNS_REGEX.exec(target)
|
const match = IPV4_REGEX.exec(target) ?? IPV6_REGEX.exec(target) ?? IPV6_BRACKET_REGEX.exec(target) ?? DNS_REGEX.exec(target)
|
||||||
if (match) {
|
if (match) {
|
||||||
return {
|
return {
|
||||||
host: match[0],
|
host: match[1],
|
||||||
port: match[1] ?? undefined
|
port: match[2] ?? undefined
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue