Mailing issueshttps://lab.civicrm.org/dev/mail/-/issues2022-06-11T14:57:27Zhttps://lab.civicrm.org/dev/mail/-/issues/10Only add closing quote to href token output when necessary2022-06-11T14:57:27ZMichael McAndrewOnly add closing quote to href token output when necessary[Lines 1345 to 1350 of CRM/Mailing/BAO/Mailing.php](https://github.com/civicrm/civicrm-core/blob/master/CRM/Mailing/BAO/Mailing.php#L1345-L1350) add a trailing quote to tokens of 'type' `embedded_url` as according to the code:
```
...[Lines 1345 to 1350 of CRM/Mailing/BAO/Mailing.php](https://github.com/civicrm/civicrm-core/blob/master/CRM/Mailing/BAO/Mailing.php#L1345-L1350) add a trailing quote to tokens of 'type' `embedded_url` as according to the code:
```
// add trailing quote since we've gobbled it up in a previous regex
// function getPatterns, line 431
```
In my testing, sometimes the trailing quote is not gobbled, e.g. in this example `<p><a href="https://example.org/communication-preferences?cid1={contact.contact_id}&{contact.checksum}">Click here to select your communication preferences</a></p>`.
As a fix, I am proposing to only add a closing quote if the url does not already have one.