Skip to content
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

Seems file extensions are not validated during multiupload #16

Open
5 of 6 tasks
tifabien opened this issue Jul 4, 2018 · 4 comments
Open
5 of 6 tasks

Seems file extensions are not validated during multiupload #16

tifabien opened this issue Jul 4, 2018 · 4 comments
Labels
BC Break bug Something isn't working

Comments

@tifabien
Copy link
Contributor

tifabien commented Jul 4, 2018

Hi,

I'm using the bundle and my user raised an issue related to file extensions. It seems that the allowedExtensions and the allowedMimeTypes properties are not took into account when the MultiUploadController::multiUploadAction method is used.

How can we do to validate the media when this controller action is called and how can we handle the form violation messages in the view?

  • Add file extension validation by javascript
  • Add MimeType validation by javascript
  • Handle Messages by javascript
  • Update Documentation
  • Create UPGRADE note
  • Use Symfony Form validation on POST

Thanks for your help!

@silasjoisten
Copy link
Owner

@tifabien is there still the need for the symfony form validation? Because its already happening on js side with mimetype and file extension

@OskarStark
Copy link
Collaborator

IIRC symfony will release symfony/mime component soon. Can this help?

@silasjoisten
Copy link
Owner

The mime-types comes from provider so before post to multiUploadAction it gets validated. So the validation depends on the configuration of the provider

   sonata.media.provider.video:
       # ...
        arguments:
           # ....
            - ['mp4', 'mov', 'flv', 'wmv', 'mxf', 'mkv','m4v','mpg']
            - ['video/mp4', 'video/quicktime', 'video/x-flv','video/x-ms-wmv','application/mxf','video/x-matroska','video/x-m4v','video/mpeg']

@tifabien
Copy link
Contributor Author

@silasjoisten I don't really remember the origin of my issue but I think there is still a need of using the Symfony form validation as I think we should not trust only the client side and do also our own validation in the controller method (isFormValid, handleRequest, ...) This way we could also for exemple use the Validator component in the Media Entity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants