Closed
Description
When importing products using the System -> Import Products feature, if there problems importing the images, Magento just fails with:
1. Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in rows: ...
No information is given about the cause of the problem, nor any help for the developer to sort it out. Generic calls to fix permissions don't really help, and it makes the process of importing products way longer than expected.
As explained here, exception handling could be improved to provide helpful messages to the developer. In particular, the following can be added to vendor/magento/module-catalog-import-export/Model/Import/Product.php
:
protected function uploadMediaFiles($fileName, $renameFileOff = false)
{
try {
$res = $this->_getUploader()->move($fileName, $renameFileOff);
return $res['file'];
} catch (\Exception $e) {
return '';
}
}
Swallowing exceptions is a very bad thing, so it'd be a good idea to improve it like this:
protected function uploadMediaFiles($fileName, $renameFileOff = false)
{
try {
$res = $this->_getUploader()->move($fileName, $renameFileOff);
return $res['file'];
} catch (\Exception $e) {
$this->_logger->critical($e);
return '';
}
}
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.3 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Failed. Automatic verification of issue format is failedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 release