-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Prevent saving upload media files in root directory #25546
Prevent saving upload media files in root directory #25546
Conversation
Hi @kenboy. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kenboy. Thank you for your collaboration.
Could you provide a little bit more information regarding the main idea of your PR, please? From the PR title/description I see that the goal is to save files to the root (it would be great if you could clarify the "root" definition here since it's completely relative) if the media directory is not writable. However, I see that the following statement:
$destinationDir = "catalog/product";
$destinationPath = $dirAddon . '/' . $this->_mediaDirectory->getRelativePath($destinationDir);
stays unchanged. So, the destination path will be the same as previously. Could you clarify this part, please?
Thank you!
Hi @rogyar
and not available for write, an exception is thrown:
setting the "\Magento\CatalogImportExport\Model\Import\Uploader::$_destDir" properties does not occur, the object is not fully formed. But since it is already stored in the property "\Magento\CatalogImportExport\Model\Import\Product::$_fileUploader", when the function is called again, an incomplete object is used. |
Hi @kenboy. Got it, now it makes sense, thank you! May I kindly ask you to cover the proposed change by a simple unit test, please? The test will invoke Thank you! |
Hi @rogyar, thank you for the review. |
✔️ QA Passed |
Hi @kenboy, thank you for your contribution! |
Description (*)
If it is impossible to save pictures to the "media" directory, the save goes to the root directory
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)