Match new lines in convertUrl regex

Created on 28 May 2024, 6 months ago
Updated 18 August 2024, 3 months 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

Fixed

Version

2.0

Component

Campaign Module

Created by

πŸ‡¨πŸ‡¦Canada brunodbo

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

Comments & Activities

Production build 0.71.5 2024