pqina / filepond

🌊 A flexible and fun JavaScript file upload library
https://pqina.nl/filepond
MIT License
15.26k stars 828 forks source link

[Bug] #802

Closed TSalu closed 2 years ago

TSalu commented 2 years ago

Is there an existing issue for this?

Have you updated FilePond and its plugins?

Describe the bug

Hello, I am unable to validate .asice files which are digitally signed files.

The mime type of .asice file is application/vnd.etsi.asic-e+zip

Reproduction

I Installed the latest version of Filepond by using the CDN method.

Example of something that I tried:

  <script>
            document.addEventListener('DOMContentLoaded', function() {

                FilePond.registerPlugin(FilePondPluginFileValidateType);

                const inputElement = document.querySelector('input[type="file"]');
                const pond = FilePond.create(inputElement);

                FilePond.setOptions({
                    allowFileTypeValidation: true,
                    acceptedFileTypes: ["application/vnd.etsi.asic-s+zip/*"],
                    server: {
                        url: '/upload',
                        headers: {
                            'X-CSRF-TOKEN': '{{ csrf_token() }}'
                        }
                    }
                });

            });

        </script>

I also tried setting the accepted file type like this: acceptedFileTypes: [".asice"]

When I did that then the Browse Explorer window only showed me .asice files(as it should) but when I clicked upload then I got this error: image

Environment

- Device: PC
- OS: Win 11
- Browser: Chrome (latest)
rikschennink commented 2 years ago

https://pqina.nl/filepond/docs/api/plugins/file-validate-type/#custom-type-detection