Open gfrancisco-sh opened 3 weeks ago
@gfrancisco-sh thank you for your report. Unfortunatly we cannot reproduce the issue. It should work without allowedMimeTypes . If we don't set it it is an empty array https://github.com/magento/magento2/blob/2.4.5-p7/app/code/Magento/Catalog/Model/ImageUploader.php#L99
Then this empty array is passed to the validation https://github.com/magento/magento2/blob/2.4.5-p7/app/code/Magento/Catalog/Model/ImageUploader.php#L248
And if array is empty checkMimeType it returns true
Maybe you have some third-party extension that modifies allowedMimeTypes for Magefan\Blog\Model\ImageUploader ? Or Magento\Catalog\Model\ImageUploader
The problem that we cannot add allowedMimeTypes to our extension yet, as we currently still provide support for Magento 2.3.0 which does not have this property. Once we stop supporting it we will be able to add this modification.
Describe the bug It's not possible to upload image using upload button in admin.
Preconditions:
To Reproduce Steps to reproduce the behavior:
Expected behavior Image is uploaded and visible when saved
Actual behavior Error message is shown: File validation failed
Screenshots
Additional context I did a research about the issue and the problem is the \Magefan\Blog\Model\ImageUploader class is overriding \Magento\Catalog\Model\ImageUploader but is missing two variables in constructor (only $allowedMimeTypes is relevant for this isse)
to fix, I changed the constructor like this:
Then, I added the allowed mime types in di for this class: