fix(line): reject lowercased LINE-shaped recipients before push (#81628) · openclaw/openclaw@f3f2c78
edenfunf
·
2026-05-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -358,6 +358,33 @@ describe("LINE send helpers", () => {
|
358 | 358 | ); |
359 | 359 | }); |
360 | 360 | |
| 361 | +it("rejects lowercased LINE-shaped recipients (#81628 safety net)", async () => { |
| 362 | +// 33-char value with lowercase leading char — what an upstream session-key |
| 363 | +// fragment looked like before the cron-tool fix. LINE rejects with HTTP 400 |
| 364 | +// anyway; throwing locally keeps the failure permanent so delivery-recovery |
| 365 | +// moves the entry to failed/ immediately instead of silently retrying 5×. |
| 366 | +await expect( |
| 367 | +sendModule.pushMessagesLine( |
| 368 | +"cabcdef0123456789abcdef0123456789", |
| 369 | +[{ type: "text", text: "hello" }], |
| 370 | +{ cfg: LINE_TEST_CFG }, |
| 371 | +), |
| 372 | +).rejects.toThrow(/Recipient is not a valid LINE id/); |
| 373 | +expect(pushMessageMock).not.toHaveBeenCalled(); |
| 374 | +}); |
| 375 | + |
| 376 | +it("accepts case-exact LINE recipients with the leading capital preserved", async () => { |
| 377 | +await sendModule.pushMessagesLine( |
| 378 | +"Cabcdef0123456789abcdef0123456789", |
| 379 | +[{ type: "text", text: "hello" }], |
| 380 | +{ cfg: LINE_TEST_CFG }, |
| 381 | +); |
| 382 | +expect(pushMessageMock).toHaveBeenCalledWith({ |
| 383 | +to: "Cabcdef0123456789abcdef0123456789", |
| 384 | +messages: [{ type: "text", text: "hello" }], |
| 385 | +}); |
| 386 | +}); |
| 387 | + |
361 | 388 | it("logs HTTP body when push fails", async () => { |
362 | 389 | const err = new Error("LINE push failed") as Error & { |
363 | 390 | status: number; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。