fix(text): remove parentheses replacement in AttachmentToText#283
fix(text): remove parentheses replacement in AttachmentToText#283Will-hxw wants to merge 3 commits intokorotovsky:masterfrom
Conversation
Removes the unconditional replacement of ( with [ and ) with ] in AttachmentToText(). This was breaking markdown link format [text](url) by converting it to [text][url]. Fixes issue where downstream consumers (LLMs, markdown renderers) could not parse attachment text containing links. The original CSV-safety escaping is unnecessary since the output format uses ; as delimiter, not comma.
|
Hi @140am @korotovsky @JAORMX , sorry to bother you. This PR has been open for a while, so I wanted to kindly check whether you might have time to review it or let me know if any changes are needed.I’m happy to make adjustments if required. Thanks! |
|
tested this a bit more against a real slack attachment payload and i think this is directionally right but still incomplete the simple unit-level case
with the url wrapped in with the current PR, that still comes back through the MCP as:
so i think the markdown parser also needs to handle the slack-shaped regexp.MustCompile(`\[([^\]]+)\]\(<?(https?://[^)>]+)>?\)`)i also tested the separate so the fix likely needs two pieces:
would also be good to add regression tests for both live-shaped cases |
- Add regex to parse [text](<url>) format from real Slack payloads - Include TitleLink in AttachmentToText output when present - Add test cases for angle-bracket markdown link format Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Good catch on the `<...>` wrapper format! I've pushed an update that handles the angle-bracket markdown link style `text`. Also added `TitleLink` support in `AttachmentToText` so `Title: text (url)` format is included. Both changes are on `fix/278-parentheses-markdown-link` branch with test coverage. Let me know if there are other edge cases to cover. |
|
the i reran the same live attachment fixture through the updated PR and the markdown-title case now comes back cleanly:
one remaining issue: the separate
looks like this is from formatting it as parts = append(parts, fmt.Sprintf("Title: [%s](%s)", att.Title, att.TitleLink))i tested that locally and against the live fixture, and it produced:
would also add a regression test for |
Change TitleLink formatting from "Title: text (url)" to markdown "[text](url)" format so it gets properly normalized by filterSpecialChars and avoids punctuation leakage. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Removes the unconditional replacement of
(with[and)with]inAttachmentToText(). This was breaking markdown link format[text](url)by converting it to[text][url].Problem
The
AttachmentToTextfunction was replacing all parentheses with square brackets:This caused markdown links like
[Read timeout](https://sentry.io/issues/123)to become[Read timeout][https://sentry.io/issues/123], which is not valid markdown.Fix
Removed both replacement lines. The original CSV-safety escaping is unnecessary since the output format uses
;as delimiter, not comma.Test plan