-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Adding product image: File doesn't exist #21978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @WalterSmulders. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @WalterSmulders do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @shikhamis11. Thank you for working on this issue.
|
@magento-engcom-team give me 2.3-develop instance |
Hi @shikhamis11. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @shikhamis11, here is your Magento instance. |
… move option. Fix for magento#21978
@WalterSmulders - the only thing I changed was |
Yeah, I know I tried that as well but I was in a hurry and if I remember correctly $destinationFile is a relative path that for some reason at that moment didn't get resolved correctly by getAbsolutePath but I can be mistaken. If it works, it works :) |
The problem exists when It moves file from $file to $destinationFile and $file after than not exist: After then we try to get wrong old file location because We have wrong $absoluteFilePath for call this function: And getMimeType throw new \InvalidArgumentException("File '$file' doesn't exist"); Solutions:
|
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
✅ Confirmed by @engcom-backlog-nazar Issue Available: @engcom-backlog-nazar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
Hi @WalterSmulders. Thank you for your report. The fix will be available with the upcoming 2.3.3 release. |
Hi @magento-engcom-team, is this fix going to be available in an upcoming 2.2.x release? |
… move option. Fix for magento#21978
Hi @WalterSmulders. Thank you for your report. The fix will be available with the upcoming 2.2.9 release. |
Uh oh!
There was an error while loading. Please reload this page.
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
[InvalidArgumentException]
File 'pub/media/import/' doesn't exist
I blocked out the prefix and suffix to the file location but these are correct. The error is because of the following:
In file: Magento\Catalog\Model\Product\Gallery\Processor
Function: addImage
Lines: 194, 195, 196
With "$absoluteFilePath = $this->mediaDirectory->getAbsolutePath($file);" the absolute path to the file in pub/media/import will be resolved. In theory this is correct. However the lines 175 till 190 can possibly move the image to a other directory. When this happens $absoluteFilePath will be filled with a path that is the old path before the move was done since it uses the variable $file. Thus resulting on $this->mime->getMimeType($absoluteFilePath); giving an exception that the file doesn't exist anymore.
Possible fix is by moving lines 194, 195, 196 to above line 175 so the checks are done before the file will be moved.
The text was updated successfully, but these errors were encountered: