From 702547d65a9cb60ca6672792c08225b1c3099bad Mon Sep 17 00:00:00 2001 From: Colin Harrington Date: Wed, 24 Jun 2020 08:43:29 -0500 Subject: fix(cli): ipv6 parsing for --allow-net params (#6453) Co-authored-by: Liming Jin --- cli/tests/complex_permissions_test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'cli/tests') diff --git a/cli/tests/complex_permissions_test.ts b/cli/tests/complex_permissions_test.ts index ad8b5302c..f4b8e6c73 100644 --- a/cli/tests/complex_permissions_test.ts +++ b/cli/tests/complex_permissions_test.ts @@ -14,7 +14,11 @@ const test: { [key: string]: Function } = { }, netListen(endpoints: string[]): void { endpoints.forEach((endpoint) => { - const [hostname, port] = endpoint.split(":"); + const index = endpoint.lastIndexOf(":"); + const [hostname, port] = [ + endpoint.substr(0, index), + endpoint.substr(index + 1), + ]; const listener = Deno.listen({ transport: "tcp", hostname, @@ -25,7 +29,11 @@ const test: { [key: string]: Function } = { }, async netConnect(endpoints: string[]): Promise { for (const endpoint of endpoints) { - const [hostname, port] = endpoint.split(":"); + const index = endpoint.lastIndexOf(":"); + const [hostname, port] = [ + endpoint.substr(0, index), + endpoint.substr(index + 1), + ]; const listener = await Deno.connect({ transport: "tcp", hostname, -- cgit v1.2.3