iachat/app/javascript/dashboard/helper/specs
Sivin Varghese ed0e87405c
fix: Strip autolinks <...> when links are not supported (#13204)
# 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
2026-01-08 18:37:52 +04:00
..
CacheHelper feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
fixtures chore: Remove defer attribute from widget-loader script (#11887) 2025-07-08 15:31:33 +05:30
actionCable.spec.js feat: Add stores for copilotMessages and copilotThreads (#11603) 2025-05-27 18:36:32 -06:00
actionQueryGenerator.spec.js feat: Add the ability to add new automation rule (#3459) 2022-02-02 18:46:07 +05:30
agentHelper.spec.js fix: Translate "None" option in agent assignment dropdown (#11060) 2025-03-11 14:49:27 -07:00
auditlogHelper.spec.js fix: TypeError: Cannot read properties of null (reading 'user_id') (#9884) 2024-08-07 14:42:01 +05:30
automationHelper.spec.js fix: Translate "None" option in automation select (#11076) 2025-03-13 16:44:46 -07:00
commons.spec.js feat: Agent assignment policy index page with CRUD actions (#12373) 2025-09-10 12:07:21 +05:30
conversationHelper.spec.js feat: Rewrite conversations mixin to a helper (#9931) 2024-08-13 15:15:04 +05:30
customViewsHelper.spec.js fix: Edit custom views folder (#7670) 2023-08-04 13:54:21 +05:30
DOMHelpers.spec.js feat: add promise based loader for FB script (#9780) 2024-07-22 11:32:05 +05:30
downloadHelper.spec.js feat: Add business hours in downloadable reports (#4674) 2022-05-27 09:26:59 +05:30
editorContentHelper.spec.js feat: Standardize rich editor across all channels (#12600) 2025-12-08 14:43:45 +05:30
editorHelper.spec.js fix: Strip autolinks <...> when links are not supported (#13204) 2026-01-08 18:37:52 +04:00
emailQuoteExtractor.spec.js feat: allow quoted email thread in reply (#12545) 2025-09-30 17:47:09 +05:30
filterQueryGenerator.spec.js feat: Custom attributes in automations and refactor (#4548) 2022-11-10 10:53:29 +05:30
flag.spec.js chore: Replace packages with native functions (#5140) 2022-08-03 17:08:21 +05:30
inbox.spec.js feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
inboxFixture.js feat: Support Regex validation for custom attributes (#7856) 2024-01-23 18:01:57 +04:00
macrosFixtures.js feat: Add assign agent option in macro (#5821) 2022-11-09 09:52:48 -08:00
macrosHelper.spec.js chore(i18n): Improvements in automation and macros (#11231) 2025-04-02 15:48:42 -07:00
permissionsHelper.spec.js chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
portalHelper.spec.js fix: Add missing 'hc' path segment after custom domain in article URLs (#11353) 2025-04-22 21:53:50 +05:30
preChat.spec.js feat: Support Regex validation for custom attributes (#7856) 2024-01-23 18:01:57 +04:00
quotedEmailHelper.spec.js fix: Rendering on email without html content (#12561) 2025-10-01 13:43:05 +05:30
ReconnectService.spec.js chore: fix circleci on vite build (#10214) 2024-10-07 15:27:41 +05:30
routeHelpers.spec.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
snoozeHelpers.spec.js feat(v4): Update Inbox view card design (#10599) 2025-01-07 21:11:54 +05:30
templateHelper.spec.js feat: Add media_name support for WhatsApp templates document files (#12462) 2025-09-18 15:25:31 +05:30
themeHelper.spec.js feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
Timer.spec.js feat: Voice Channel (#11602) 2025-12-19 12:41:33 -08:00
uploadHelper.spec.js feat: Add the ability to paste images to editor (#10072) 2024-09-11 09:44:13 +05:30
URLHelper.spec.js feat: Add UI to manage web widget allowed domains (#12495) 2025-09-24 16:46:19 +05:30
validations.spec.js chore: Remove unused files in contact (#10570) 2024-12-11 19:29:24 -08:00