`@TrackLink` Corrupts Tracked Links on Complex URLs
Version:
- listmonk: v6
- OS: Docker
Affected scope
- Module: email campaigns
- Feature: link tracking
- Affected syntax:
@TrackLink - Affected link types:
- Platform URLs
- Long URLs
- URLs containing complex query parameters
- URLs containing special characters
- URLs containing Unicode characters
- URLs containing emojis
- Observed impact:
- Sent links become invalid;
- Client links are no longer clickable properly;
- The
@TrackLinksuffix may be retained or misinterpreted in the final URL; - Sent campaigns may contain corrupted links.
Root cause
The issue is located in ./models/common.go, in the regex pattern used to detect @TrackLink occurrences.
The current pattern strictly follows RFC 3986 URL syntax, which excludes characters such as Unicode, emojis, and unencoded special characters. However, real-world client URLs — particularly those generated by platforms like SharePoint — often follow IRI (Internationalized Resource Identifier) conventions, which allow a broader character set.
As a result, the regex fails to match these URLs and leaves the @TrackLink suffix unprocessed and appended to the raw URL.
Suggested fix
Replacing the current pattern with a more permissive one that accommodates IRI-style URLs:
(https?://[^\s<>"{}]*)@TrackLink\bThis pattern captures everything up to the first whitespace or structural HTML character, making it robust against URLs containing Unicode characters, emojis, encoded sequences, and long query strings.
Affected code examples
Basic example
<a href="https://client.platform.com/sites/Project/Documents%20shared/Client%20form%20✅.aspx?web=1¶m=value@TrackLink">
Open client document
</a>Long URL example
<a href="https://client.platform.com/:x:/r/sites/Management/Shared%20Documents/Reports/2026/Marketing%20campaign%20report%20-%20final%20version%20.xlsx?d=w123456789abcdef&csf=1&web=1&e=AbCdEf@TrackLink">
View report
</a>Special characters example
<a href="https://client.example.com/document?id=12345&name=client-presentation&status=validated&emoji=✅@TrackLink">
View presentation
</a>Partially encoded URL example
<a href="https://client.platform.com/sites/Project/Shared%20Documents/Team%20meeting%20notes%20.docx?web=1&download=1@TrackLink">
Download meeting notes
</a>Actual result
<a href="https://client.platform.com/sites/Project/Documents%20shared/Client%20form%20✅.aspx?web=1¶m=value@TrackLink">
Open client document
</a>The @TrackLink suffix is appended directly to the URL without any processing, resulting in a malformed and non-functional link.
Expected result
<a href="[LISTMONK_TRACKING_URL]">
Open client document
</a>The original URL should be properly encoded and wrapped in a listmonk tracking URL, with @TrackLink fully removed from the final output.
Source: knadh/listmonk