Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLs using CiviCRM tokens in base templates are being rewritten by mosaico library code #636

Closed
johntwyman opened this issue Feb 26, 2024 · 1 comment

Comments

@johntwyman
Copy link

We have some custom base templates that include the CiviCRM {action.unsubscribeUrl} and {action.optOutUrl} tokens:

<a href="{action.unsubscribeUrl}" target="_blank" style="text-decoration:none;color:#ffffff;"><span style="color:#ffffff;">Unsubscribe from this list</span></a>

When creating a new mailing from these base templates, we find that the URLs are being rewritten to:

<a href="http://cividev.localhost:7979/sites/default/files/civicrm/ext/customtmosaicotemplates/basetemplate/{action.unsubscrubeUrl}" ...

After some investigation, the cause of the problem lies in this function in the mosaico library. It's invoked by way of the code starting at this comment.

Because {action.unsubscribeUrl} does not meet any of the regex patterns, the URL is rewritten to include the base path of the extension.

I can't think of any reason why we could not include a regex along the lines of /^\{/?

@johntwyman
Copy link
Author

Pinging @seamuslee001 as we've been discussing this already.

mattwire pushed a commit to civicrm/mosaico that referenced this issue Feb 26, 2024
…ermmiting urls to start with { e.g. {action.optOutUrl}
mattwire pushed a commit to civicrm/mosaico that referenced this issue Sep 6, 2024
…ermmiting urls to start with { e.g. {action.optOutUrl}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant