From 30db5af5b596e267db136a218209a65cc9fde36e Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 21 Feb 2018 03:59:22 -0800 Subject: [PATCH] Fixed #2463 --- CHANGELOG-v3.md | 3 +++ src/services/AssetTransforms.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 6f8a724a59b..0d793f0a00f 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -2,6 +2,9 @@ ## Unreleased +### Fixed +- Fixed an error that occurred when creating a new transform or thumbnail for a remotely-stored image, if Craft didn’t already have a copy of the image cached locally. ([#2463](https://github.com/craftcms/cms/issues/2463)) + ## 3.0.0-RC11 - 2018-02-20 ### Added diff --git a/src/services/AssetTransforms.php b/src/services/AssetTransforms.php index 646080c31c9..ead54fd18f0 100644 --- a/src/services/AssetTransforms.php +++ b/src/services/AssetTransforms.php @@ -816,7 +816,7 @@ public function getLocalImageSource(Asset $asset): string if (!is_file($imageSourcePath) || filesize($imageSourcePath) === 0) { // Delete it just in case it's a 0-byter - if (!FileHelper::unlink($imageSourcePath)) { + if (file_exists($imageSourcePath) && !FileHelper::unlink($imageSourcePath)) { Craft::warning("Unable to delete the file \"{$imageSourcePath}\".", __METHOD__); }