summaryrefslogtreecommitdiff
path: root/cli/tests/complex_permissions_test.ts
diff options
context:
space:
mode:
authorColin Harrington <colin.harrington@gmail.com>2020-06-24 08:43:29 -0500
committerGitHub <noreply@github.com>2020-06-24 09:43:29 -0400
commit702547d65a9cb60ca6672792c08225b1c3099bad (patch)
tree0497e072f09aa9f725c756a4c29160b37f91e176 /cli/tests/complex_permissions_test.ts
parenta354b248ea8ecb7fb10742322d7a36ad71eddf0a (diff)
fix(cli): ipv6 parsing for --allow-net params (#6453)
Co-authored-by: Liming Jin <jinliming2@gmail.com>
Diffstat (limited to 'cli/tests/complex_permissions_test.ts')
-rw-r--r--cli/tests/complex_permissions_test.ts12
1 files changed, 10 insertions, 2 deletions
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<void> {
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,