mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:40:42 +00:00
fix(gateway): trim ssh command prefixes
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
resolveAuthForTarget,
|
resolveAuthForTarget,
|
||||||
resolveProbeBudgetMs,
|
resolveProbeBudgetMs,
|
||||||
resolveTargets,
|
resolveTargets,
|
||||||
|
sanitizeSshTarget,
|
||||||
} from "./helpers.js";
|
} from "./helpers.js";
|
||||||
import { createSecretRefGatewayConfig } from "./test-support.js";
|
import { createSecretRefGatewayConfig } from "./test-support.js";
|
||||||
|
|
||||||
@@ -369,3 +370,10 @@ describe("resolveProbeBudgetMs", () => {
|
|||||||
).toBe(2000);
|
).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) {
|
if (!trimmed) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return trimmed.replace(/^ssh\\s+/, "");
|
return trimmed.replace(/^ssh\s+/, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveAuthForTarget(
|
export async function resolveAuthForTarget(
|
||||||
|
|||||||
Reference in New Issue
Block a user