Skip to content

Commit b96019f

Browse files
author
Oleksii Korshenko
committed
MAGETWO-70395: Fixed pointless exception in logs every time a category with image is saved #9904
- Merge Pull Request #9904 from woutersamaey/magento2:fixed-category-save-image-upload-exception-in-logs - Merged commits: 1. 5e7c906
2 parents 8868a95 + 5e7c906 commit b96019f

File tree

1 file changed

+8
-5
lines changed
  • app/code/Magento/Catalog/Model/Category/Attribute/Backend

1 file changed

+8
-5
lines changed

app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,14 @@ public function afterSave($object)
128128
{
129129
$value = $object->getData($this->additionalData . $this->getAttribute()->getName());
130130

131-
if ($imageName = $this->getUploadedImageName($value)) {
132-
try {
133-
$this->getImageUploader()->moveFileFromTmp($imageName);
134-
} catch (\Exception $e) {
135-
$this->_logger->critical($e);
131+
if(isset($value[0]['tmp_name'])) {
132+
// A file was just uploaded, so process it
133+
if ($imageName = $this->getUploadedImageName($value)) {
134+
try {
135+
$this->getImageUploader()->moveFileFromTmp($imageName);
136+
} catch (\Exception $e) {
137+
$this->_logger->critical($e);
138+
}
136139
}
137140
}
138141

0 commit comments

Comments
 (0)