mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:10:44 +00:00
fix(gateway): trim ssh command prefixes
This commit is contained in:
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user