From 4800d4e1d747b5ec272fbd080443c6fcfd8869b8 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Mon, 20 Apr 2026 11:48:59 +0530 Subject: [PATCH] fix(gateway): trim ssh command prefixes --- src/commands/gateway-status/helpers.test.ts | 8 ++++++++ src/commands/gateway-status/helpers.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/commands/gateway-status/helpers.test.ts b/src/commands/gateway-status/helpers.test.ts index cdf50f00c23..a8dd4cf96d5 100644 --- a/src/commands/gateway-status/helpers.test.ts +++ b/src/commands/gateway-status/helpers.test.ts @@ -9,6 +9,7 @@ import { resolveAuthForTarget, resolveProbeBudgetMs, resolveTargets, + sanitizeSshTarget, } from "./helpers.js"; import { createSecretRefGatewayConfig } from "./test-support.js"; @@ -369,3 +370,10 @@ describe("resolveProbeBudgetMs", () => { ).toBe(2000); }); }); + +describe("sanitizeSshTarget", () => { + it("strips a leading ssh command prefix", () => { + expect(sanitizeSshTarget("ssh me@studio")).toBe("me@studio"); + expect(sanitizeSshTarget(" ssh me@studio:2222 ")).toBe("me@studio:2222"); + }); +}); diff --git a/src/commands/gateway-status/helpers.ts b/src/commands/gateway-status/helpers.ts index 2a0fc3ffa1b..6ec6c1db615 100644 --- a/src/commands/gateway-status/helpers.ts +++ b/src/commands/gateway-status/helpers.ts @@ -156,7 +156,7 @@ export function sanitizeSshTarget(value: unknown): string | null { if (!trimmed) { return null; } - return trimmed.replace(/^ssh\\s+/, ""); + return trimmed.replace(/^ssh\s+/, ""); } export async function resolveAuthForTarget(