You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys,
in the validate method of Sylius\Bundle\CoreBundle\Validator\Constraints\AllowedImageMimeTypesValidator a value of Symfony\Component\HttpFoundation\File\UploadedFile has been required only to check its mime type.
But in my opinion the validator should check for Symfony\Component\HttpFoundation\File\File instead of UploadedFile.
The getMimeType() is defined on the Symfony\Component\HttpFoundation\File\File class.
Moreover doing so will force to have Product images only set by form upload but there could be different flows setting File to Product objects (and not UploadedFile). For example in our SyliusAkeneoPlugin we have the ImageValueHandler which sets a File on the Product and not an UploadedFile because the image is not uploaded from the admin panel form but it's imported from Akeneo.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys,
in the
validatemethod ofSylius\Bundle\CoreBundle\Validator\Constraints\AllowedImageMimeTypesValidatora value ofSymfony\Component\HttpFoundation\File\UploadedFilehas been required only to check its mime type.But in my opinion the validator should check for
Symfony\Component\HttpFoundation\File\Fileinstead ofUploadedFile.The
getMimeType()is defined on theSymfony\Component\HttpFoundation\File\Fileclass.Moreover doing so will force to have Product images only set by form upload but there could be different flows setting File to Product objects (and not UploadedFile). For example in our SyliusAkeneoPlugin we have the ImageValueHandler which sets a File on the Product and not an UploadedFile because the image is not uploaded from the admin panel form but it's imported from Akeneo.
Beta Was this translation helpful? Give feedback.
All reactions