From 70b0d06f94d24903e04c7d4690f737ed1b73d0b1 Mon Sep 17 00:00:00 2001 From: Viktor Kopin Date: Fri, 4 Sep 2020 16:59:28 +0300 Subject: [PATCH] adobe-stock-integration#1792: fix category image is not removed from tmp folder after category save --- .../Plugin/SaveBaseCategoryImageInformation.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/MediaGalleryCatalogIntegration/Plugin/SaveBaseCategoryImageInformation.php b/app/code/Magento/MediaGalleryCatalogIntegration/Plugin/SaveBaseCategoryImageInformation.php index d439b53c120cb..b683ec8fe9d91 100644 --- a/app/code/Magento/MediaGalleryCatalogIntegration/Plugin/SaveBaseCategoryImageInformation.php +++ b/app/code/Magento/MediaGalleryCatalogIntegration/Plugin/SaveBaseCategoryImageInformation.php @@ -81,17 +81,18 @@ public function __construct( * * @param ImageUploader $subject * @param string $imagePath + * @param string $initialImageName * @return string * @throws LocalizedException */ - public function afterMoveFileFromTmp(ImageUploader $subject, string $imagePath): string + public function afterMoveFileFromTmp(ImageUploader $subject, string $imagePath, string $initialImageName): string { if (!$this->config->isEnabled()) { return $imagePath; } $absolutePath = $this->storage->getCmsWysiwygImages()->getStorageRoot() . $imagePath; - $tmpPath = $subject->getBaseTmpPath() . '/' . substr(strrchr($imagePath, '/'), 1); + $tmpPath = $subject->getBaseTmpPath() . '/' . $initialImageName; $tmpAssets = $this->getAssetsByPaths->execute([$tmpPath]); if (!empty($tmpAssets)) {