mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 07:28:38 +00:00
fix: sanitize native command names for Telegram API (#19257)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: b608be3488
Co-authored-by: akramcodez <179671552+akramcodez@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -21,7 +21,7 @@ describe("telegram custom commands schema", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("rejects custom commands with invalid names", () => {
|
||||
it("normalizes hyphens in custom command names", () => {
|
||||
const res = OpenClawSchema.safeParse({
|
||||
channels: {
|
||||
telegram: {
|
||||
@@ -30,17 +30,13 @@ describe("telegram custom commands schema", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.success).toBe(false);
|
||||
if (res.success) {
|
||||
expect(res.success).toBe(true);
|
||||
if (!res.success) {
|
||||
return;
|
||||
}
|
||||
|
||||
expect(
|
||||
res.error.issues.some(
|
||||
(issue) =>
|
||||
issue.path.join(".") === "channels.telegram.customCommands.0.command" &&
|
||||
issue.message.includes("invalid"),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(res.data.channels?.telegram?.customCommands).toEqual([
|
||||
{ command: "bad_name", description: "Override status" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user