# Pull Request Template ## Description This PR fixes the crash that occurred when inserting canned responses containing **autolinks** (e.g. `<https://example.com>`) into reply channels that **do not support links**, such as **Twilio SMS**. ### Steps to reproduce 1. Create a canned response with an autolink, for example: `<https://example.com>`. 2. Open a conversation in a channel that does not support links (e.g. SMS). 3. Insert the canned response into the reply box. ### Cause * Currently, only standard markdown links (`[text](url)`) are handled when stripping unsupported formats from canned responses. * Autolinks (`<https://example.com>`) are not handled during this process. * As a result, **Error: Token type link_open not supported by Markdown parser** ### Solution * Extended the markdown link parsing logic to explicitly handle **autolinks** in addition to standard markdown links. * When a canned response containing an autolink is inserted into a reply box for a channel that does not support links (e.g. SMS), the angle brackets (`< >`) are stripped. * The autolink is safely pasted as **plain text URL**, preventing parser errors and editor crashes. Fixes https://linear.app/chatwoot/issue/CW-6256/error-token-type-link-open-not-supported-by-markdown-parser Sentry issues [[1](https://chatwoot-p3.sentry.io/issues/7103543778/?environment=production&project=4507182691975168&query=is%3Aunresolved%20markdown&referrer=issue-stream)], [[2](https://chatwoot-p3.sentry.io/issues/7104325962/?environment=production&project=4507182691975168&query=is%3Aunresolved%20markdown&referrer=issue-stream )] ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
6.2 KiB
6.2 KiB