From 1d3af3245ac09197f554ebc27a4311f66839db30 Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Wed, 26 Jun 2019 13:44:16 +0300 Subject: [PATCH] ssh: Fix incorrect parsing of numeric short UUIDs Resolves: #1302 Change-type: patch Signed-off-by: Thodoris Greasidis --- lib/actions/ssh.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/actions/ssh.ts b/lib/actions/ssh.ts index 0df7f878..6953714e 100644 --- a/lib/actions/ssh.ts +++ b/lib/actions/ssh.ts @@ -162,6 +162,9 @@ function generateVpnSshCommand(opts: { export const ssh: CommandDefinition< { applicationOrDevice: string; + // when Capitano converts a positional parameter (but not an option) + // to a number, the original value is preserved with the _raw suffix + applicationOrDevice_raw: string; serviceName?: string; }, { @@ -221,6 +224,8 @@ export const ssh: CommandDefinition< }, ], action: async (params, options) => { + const applicationOrDevice = + params.applicationOrDevice_raw || params.applicationOrDevice; const bash = await import('bash'); // TODO: Make this typed const hasbin = require('hasbin'); @@ -241,12 +246,12 @@ export const ssh: CommandDefinition< // if we're doing a direct SSH connection locally... if ( - validateDotLocalUrl(params.applicationOrDevice) || - validateIPAddress(params.applicationOrDevice) + validateDotLocalUrl(applicationOrDevice) || + validateIPAddress(applicationOrDevice) ) { const { performLocalDeviceSSH } = await import('../utils/device/ssh'); return await performLocalDeviceSSH({ - address: params.applicationOrDevice, + address: applicationOrDevice, port, verbose, service: params.serviceName, @@ -255,7 +260,7 @@ export const ssh: CommandDefinition< // this will be a tunnelled SSH connection... exitIfNotLoggedIn(); - const uuid = await getOnlineTargetUuid(sdk, params.applicationOrDevice); + const uuid = await getOnlineTargetUuid(sdk, applicationOrDevice); let version: string | undefined; let id: number | undefined;