Match new lines in convertUrl regex

Created on 28 May 2024, about 1 month ago

Problem/Motivation

The regex in \Drupal\mailchimp_campaign\Plugin\Filter\FilterMailchimpCampaign::convertUrl doesn't match HTML tags that are spread over multiple lines (this can happen in Twig templates), leading to some links not be converted to absolute links.

Steps to reproduce

Build a campaign with the following example HTML, the link will not be converted to an absolute link.

This is a test campaign.

<a
         href="/node/1">First node</a>

Proposed resolution

In the regex, use a character class that matches any character, except the tag's closing bracket: [^>]*?. See attached patch.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Campaign Module

Created by

πŸ‡¨πŸ‡¦Canada brunodbo Coast Salish Territory

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024