Skip to content

Commit

Permalink
Merge pull request #13266 from craftcms/bugfix/13264-transform-images…
Browse files Browse the repository at this point in the history
…-with-very-long-names

fix for transforming images with very long names
  • Loading branch information
brandonkelly authored Jun 12, 2023
2 parents 4b58d22 + 8d3f254 commit 31e28db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed a styling issue with control panel notifications. ([#13258](https://github.com/craftcms/cms/pull/13258))
- Fixed a bug where element thumbnails could stop getting loaded when quickly switching between element sources. ([#13253](https://github.com/craftcms/cms/issues/13253))
- Fixed an error that occurred when uploading an asset with a filename over 232 characters long, directly to an Assets field. ([#13264](https://github.com/craftcms/cms/issues/13264))
- Fixed an error that occurred when transforming an image with a filename over 232 characters long. ([#13266](https://github.com/craftcms/cms/pull/13266))
- Fixed a SQL error that could occur when upgrading to 4.4 on PostgreSQL, if the database was converted from MySQL. ([#12855](https://github.com/craftcms/cms/issues/12855))
- Fixed a bug where `craft\db\Query::collect()` was returning a `craft\elements\ElementCollection` instance.
- Fixed a SQL error that could occur when upgrading to Craft 4 if any database tables had foreign keys to `entryversions` or other now-unused tables that are removed during the upgrade.
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/ImageTransforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public static function generateTransform(
}

// Save it!
$tempFilename = sprintf('%s.%s', uniqid($asset->getFilename(false), true), $format);
$tempFilename = FileHelper::uniqueName($asset->getFilename());
$tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename;
$image->saveAs($tempPath);
clearstatcache(true, $tempPath);
Expand Down

0 comments on commit 31e28db

Please sign in to comment.