fix: TrackLink Unicode/emoji URLs, bounce multipart infinite loop, opt-in List-Unsubscribe - #3080
Conversation
…bscribe **knadh#3076 — @Tracklink corrupts Unicode/emoji URLs** The RFC3986 character class `[\p{L}\p{N}_-...]` excluded emoji (Unicode category \p{So}) and other IRI characters. Replace with lazy `\S+?` which stops at the first `@TrackLink` suffix and handles all non-whitespace URL characters including Unicode, emoji, and percent-encoded sequences. **knadh#3071 — Bounce multipart reader loops on malformed messages** After a non-EOF error from `mr.NextPart()`, the code did `continue`, re-entering the loop and calling `NextPart()` on the same broken reader indefinitely. Changed to `break` so we process whatever was successfully read and skip the rest of the malformed message. **knadh#3063 — List-Unsubscribe-Post header non-functional on opt-in emails** Opt-in confirmation emails use `dummyUUID` as the campaign UUID in the unsubscribe URL; the unsubscribe route rejects this, making RFC 8058 one-click unsubscription silently fail. Removed `List-Unsubscribe-Post` (the one-click trigger) and the duplicate `unsubURL` computation (using the already-constructed `out.UnsubURL`). The informational `List-Unsubscribe` header is retained so email clients still display a visible unsubscribe link. Relates to: knadh#3076, knadh#3071, knadh#3063 Signed-off-by: Pulkit Kumar <pulkit.talks@gmail.com>
|
Hi @buddywhitman, Thanks for the contributions. Regarding #3063 (the issue I created) I don't think this is a helpful fix. While technically correct removing the Footnotes |
|
On a broader but linked note to the above it isn't great practice to lump multiple issues and their fixes into a single PR as it makes discussion and eventual merging harder for maintainers (FYI which I am not for this project)
#3076 has a PR that is already open - #3077 which was opened ~3 days ago |
|
Hi @blu3id Have some ideas for implementing a fix for your flagged issue, will discuss further in the respective issue thread. Closing this PR for now. |
Fixes three reported bugs with no existing open PRs.
Changes
Fix #3076 — TrackLink regex drops URLs containing emoji or non-ASCII Unicode
The original regex
[\p{L}\p{N}_\-\.~!#$&'()*+,/:;=?@\[\]%]*covers Unicodeletters/numbers but not emoji (Unicode category
So), so campaign links withemoji in query params or fragments were silently truncated.
Fix: replace with
\S+?(lazy non-whitespace). The@TrackLinksuffix anchorsthe match, so the lazy quantifier stops at the right boundary and handles any
non-whitespace URL character including emoji.
Fix #3071 — bounce POP processor: infinite loop on broken multipart message
In
internal/bounce/mailbox/pop.go, the multipart-parse loop usedcontinueon non-EOF errors from
mr.NextPart(). A broken reader returns the same errorforever, spinning the loop indefinitely.
Fix:
breakinstead ofcontinueon non-EOF errors.Fix #3063 — List-Unsubscribe header non-functional on opt-in (non-campaign) emails
Opt-in emails use
dummyUUIDas the campaign UUID in the unsubscribe URL, whichthe route rejects — so clicking the header link returned a 404/error. The code
also set
List-Unsubscribe-Post(RFC 8058 one-click), which requires the URL toactually work.
Fix: Remove
List-Unsubscribe-Post(one-click requires a working endpoint).Keep the informational
List-Unsubscribeheader using the already-resolvedout.UnsubURLrather than re-constructing it withdummyUUID.Testing
go build ./...passes