fix(link-understanding): strip markdown links whose label contains br… · openclaw/openclaw@d4a01e4
ly-wang19
·
2026-06-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,6 +20,15 @@ describe("extractLinksFromMessage", () => {
|
20 | 20 | expect(links).toEqual(["https://bare.example"]); |
21 | 21 | }); |
22 | 22 | |
| 23 | +it("ignores markdown links whose label contains brackets", () => { |
| 24 | +// The closing "]" inside the label must not break markdown stripping, otherwise |
| 25 | +// the citation URL leaks out as a bare link (with a stray trailing ")"). |
| 26 | +const links = extractLinksFromMessage( |
| 27 | +"Check [my notes [v2]](https://internal.example/doc) for details", |
| 28 | +); |
| 29 | +expect(links).toStrictEqual([]); |
| 30 | +}); |
| 31 | + |
23 | 32 | it("blocks 127.0.0.1", () => { |
24 | 33 | const links = extractLinksFromMessage("http://127.0.0.1/test https://ok.test"); |
25 | 34 | expect(links).toEqual(["https://ok.test"]); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。