Skip to content

Commit

Permalink
Merge pull request #16495 from craftcms/bugfix/srcset-urls
Browse files Browse the repository at this point in the history
Unset name/handle for srcset size transforms
  • Loading branch information
brandonkelly authored Jan 22, 2025
2 parents 60a5221 + b3e9867 commit 012948a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a bug where all multi-byte characters were getting stripped out of search indexes. ([#16457](https://github.com/craftcms/cms/issues/16457))
- Fixed a bug where Color fields weren’t translating color palette labels.
- Fixed a bug where `craft\elements\Asset::getSrcset()` (and `srcset` method arguments) weren’t producing the correct transform URLs if the asset already had a named transform applied to it. ([#16486](https://github.com/craftcms/cms/issues/16486))

## 5.6.0.2 - 2025-01-21

Expand Down
2 changes: 2 additions & 0 deletions src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,8 @@ public function getUrlsBySize(array $sizes, mixed $transform = null): array

$sizeTransform = $transform ? $transform->toArray() : [];

unset($sizeTransform['name'], $sizeTransform['handle']);

if ($unit === 'w') {
$sizeTransform['width'] = (int)$value;
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/services/ImageTransforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ public function eagerLoadTransforms(array $assets, array $transforms): void
...$refTransform->toArray(),
]);

unset($transform->name, $transform->handle);

if ($sizeUnit === 'w') {
$transform->width = (int)$sizeValue;
} else {
Expand Down

0 comments on commit 012948a

Please sign in to comment.