Skip to content

update the transform regex to account for image format transform too#591

Open
i-just wants to merge 1 commit into
5.xfrom
bugfix/588-image-format-transform-url
Open

update the transform regex to account for image format transform too#591
i-just wants to merge 1 commit into
5.xfrom
bugfix/588-image-format-transform-url

Conversation

@i-just
Copy link
Copy Markdown
Contributor

@i-just i-just commented May 22, 2026

Description

The transform subfolder is always based on the transform string, but if the transform also changes the filename (e.g., the image format), the subfolder is based on the asset ID as well. For example:
/_toWebp/100C.webp
/_toWebp/123/100C.webp

The code: https://github.com/craftcms/cms/blob/5.10.2/src/imagetransforms/ImageTransformer.php#L316-L325.

When you select an image to insert into a CKEditor field (image mode: tags) and choose a transform in the modal, we check whether the URL is transformed and matches the first pattern, but not the second.

This PR updates the regex used to check whether the URL is for a transformed asset to account for the asset ID potentially appearing after the transform string.

Related issues

#588

@i-just i-just requested a review from brandonkelly as a code owner May 22, 2026 11:49
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

Successfully merging this pull request may close these issues.

1 participant